使用php更新xml中的节点值

时间:2010-08-05 06:38:10

标签: xml

这是我的xml文件。我想更新它。什么是更新此xml文件的最简单方法。任何节点值,如电影标签中的视频文件,标题标签中的标题等。

<?xml version="1.0"?>
<gallerylist>
  <record>
    <movie>videos/Avatar_HD.flv</movie>
    <title>Title:</title>
    <desc>Description</desc>
    <preview>videos/previews/avatar.jpg</preview>
    <imgplaylist>videos/imgplaylist/p1.jpg</imgplaylist>
    <category>Category</category>
  </record>
 <record>
    <movie>videos/The_Princess_And_The_Frog_HD.flv</movie>
    <title></title>
    <desc>fdgdd</desc>
    <preview>videos/previews/frog.jpg</preview>
    <imgplaylist>videos/imgplaylist/p4.jpg</imgplaylist>
    <category>Category1</category>
 </record>
    <record>
        <movie>videos/Prince_of_Persia_The_Sands_of_Time_HD.flv</movie>
        <title>Title:2</title>
        <desc>xzcXZ</desc>
        <preview>videos/previews/sandsoftime.jpg</preview>
        <imgplaylist>videos/imgplaylist/p2.jpg</imgplaylist>
        <category>Category2</category>
    </record>
    <record>
        <movie>videos/Sherlock_Holmes_HD.flv</movie>
        <title>Title:4</title>
        <desc>dfgdf</desc>
        <preview>videos/previews/sherlock.jpg</preview>
        <imgplaylist>videos/imgplaylist/p7.jpg</imgplaylist>
        <category>Category4</category>
    </record>
</gallerylist>

1 个答案:

答案 0 :(得分:0)

查看一些用于处理xml文件的php库。像这样:http://www.php.net/manual/en/book.simplexml.php