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 nslt的可用模型,或者其他可以进行推理的现有模型
  • ¥15 arduino上连sim900a实现连接mqtt服务器
  • ¥15 vncviewer7.0安装后如何正确注册License许可证,激活使用
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并2
  • ¥66 关于人体营养与饮食规划的线性规划模型
  • ¥15 基于深度学习的快递面单识别系统
  • ¥15 Multisim仿真设计地铁到站提醒电路
  • ¥15 怎么用一个500W电源给5台60W的电脑供电
  • ¥15 请推荐一个轻量级规则引擎,配合流程引擎使用,规则引擎负责判断出符合规则的流程引擎模板id
  • ¥15 Excel表只有年月怎么计算年龄