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 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置