douwanc63652 2012-04-02 19:16
浏览 22
已采纳

如何从xml文件中检索日期[关闭]

this is my xml file,i do not known how to retrieve value from xml file using php,how to retrieve infromation from the xml file.if you known please help me.

  my xml file:
  see:http://en.wikipedia.org/w/api.php?  format=xml&action=query&titles=vikram&prop=revisions&rvprop=content


  <api>
  <query>
  <normalized>
   <n from="vikram" to="Vikram"/>
   </normalized>
   <pages>
   <page pageid="1034501" ns="0" title="Vikram">
    <revisions>
    <rev xml:space="preserve">
    '''Vikram''' may refer to: *[[Vikram (name)]], a male name in the Hindu  
    community *[[Vikramāditya]], a legendary king of India **Vikram, a character
   in   ''[[Baital Pachisi]]'', identified with Vikramāditya **[[Vikram Samvat]]
  (Vikram's Era, "V.S." or "B.S"), a popularly used calendar in India and the 
  official calendar of Nepal, established by Vikramaditya *[[Vikram Pandit]], 
  CitiGroup CEO *[[Vikram (actor)]], Vikram Kennedy, a Tamil-language Indian 
 film actor *[[Vikram Sarabhai]], an Indian scientist *[[Vikram 
 (film)|''Vikram'' (film)]], a 1986 Tamil-language Indian film *[[Vikram (1986 
 Telugu film)|''Vikram'' (1986 Telugu film)]], a 1986 Telugu-language Indian 
 film *[[Vikram Seth]], a bestselling author of Indian origin ;See also: *
 {{lookfrom|Vikram}} *{{intitle|Vikram}} {{disambig}}
 </rev>
 </revisions>
 </page>
 </pages>
 </query>
 </api>
  • 写回答

2条回答 默认 最新

  • dongpo3957 2012-04-02 19:26
    关注

    You can use the xml_parse_into_struct() function for an easy to parse XML.

    <?php
    $simple = "<para><note>simple note</note></para>";
    $p = xml_parser_create();
    xml_parse_into_struct($p, $simple, $vals, $index);
    xml_parser_free($p);
    echo "Index array
    ";
    print_r($index);
    echo "
    Vals array
    ";
    print_r($vals);
    ?>
    

    source

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python ModuleNotFoundError报错,如何解决?
  • ¥15 我下载图形界面重启完就变成这样了,打字也打不了,动也动不了,该怎么解决(操作系统-centos)
  • ¥15 VBA中在窗体中遍历所有checkbox控件,提取出被选中的checkbox的caption值
  • ¥15 在Ubuntu上有什么命令,或者是系统文件能告诉我链接nvme ssd的pcie槽位是不是支持热插拔功能?
  • ¥15 ansys license许可证问题
  • ¥20 QQ号和密码都能正常登录微信 QQ号和密码登录微信显示密码错误
  • ¥15 qiankun主应用注册子应用提示跨域
  • ¥15 单片机RTOS Kernel与应用分离开发,Kernel如何调起应用?
  • ¥15 快手小店商家版APP怎么第三方APP跳转到指定用户聊天界面
  • ¥15 为什么AVL fire软件仿真时的步长改变了,仿真结果也会改变