doufei7516 2016-06-08 21:57
浏览 59


I have currently an xml file that is formatted as follows:

          <Question>Does the front Camera Work?</Question>
          <Question>Does the Rear Camera Work?</Question>

I am currently getting the info from the "answer" nodes by calling where it occurs in the xml for example:

    $qFrontCameraWorks = $data['skuQuestions']->SKUQuestion[4];
    $data['frontCameraWorks'] = str_replace("'", "\'", $qFrontCameraWorks->Answer);

my problem is the xml files don't always come to me with the questions in the same order.

So, I was wanting to figure a way to query within a "SKUquestion" node if the "tag" is one thing then it would return the value of the "answer" node within that same SKUquestion node.

for example if the tag is "FrontCamaraWorks" then $data['frontCameraWorks'] is yes.

  • 写回答

2条回答 默认 最新


    相关推荐 更多相似问题


    • ¥15 用循环结构解决,刚学C语言
    • ¥16 请问pyglet如何做出不同按扭跳转不同页面的效果,以及如何储存选择选项的次数(语言-python)
    • ¥15 python怎么自动填表、登录?
    • ¥15 python列表嵌套按条件合并
    • ¥15 VBA怎么把工作簿A中的第N列,复制到工作簿B中的第N列。
    • ¥20 除了狗屎npm, 推荐一些编写web应用的方式?
    • ¥30 如何对嵌套结构体进行动态内存分配
    • ¥15 关于sprintf的几个问题
    • ¥15 不确定行列数的迷宫文件传入
    • ¥15 怎么解决kali linux从root文件夹里复制文件权限不够的问题