douyuai8994 2011-06-01 09:32
浏览 24
已采纳

用简单的馅饼从原子进料中拉出<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>

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');

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

  • 写回答

1条回答 默认 最新

  • duanpao4522 2011-06-03 15:33
    关注

    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">
    

    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');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料