拉< s:variant>从简单的原子饲料中提取 [英] Pulling <s:variant> from atom feed with simple pie

查看:96
本文介绍了拉< s:variant>从简单的原子饲料中提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用简单的pie从下面的s:variant块中获得标题标签?

How can I get the title tag from the s:variant block below using simple pie?

<s:variant>
  <id>product_variants-96590662</id>
  <title>Default Title</title>
  <s:price currency="GBP">10.00</s:price>
  <s:sku>002</s:sku>
  <s:grams>0</s:grams>
</s:variant>

我尝试了以下方法,还有'variant'和's'

I've tried the following to avail, and also 'variant' and just 's'

$caption = $item->get_item_tags('http://www.w3.org/2005/Atom', 's:variant');

有问题的供稿是此处(来自shopify),并且有关get_item_tags的文档,请此处.

The feed in question is here (from shopify), and the docs on get_item_tags is here.

推荐答案

您可以从<feed>标记中读取s的xml名称空间.

You can read the xml namespace for s from the <feed> tag.

<feed xmlns:s="http://jadedpixel.com/-/spec/shopify" xml:lang="en-US" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">

根据它,您必须使用http://jadedpixel.com/-/spec/shopify作为get_item_tags()中的名称空间参数,第二个参数是不带s:的标记名称.

According to it you have to use http://jadedpixel.com/-/spec/shopify as the namespace parameter in get_item_tags(), and the second parameter is the tag name without the s:.

$varinat = $item->get_item_tags('http://jadedpixel.com/-/spec/shopify', 'variant');

这篇关于拉&lt; s:variant&gt;从简单的原子饲料中提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆