SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Xml Dom?

  1. #1
    web daemon jorasmi's Avatar
    Join Date
    Nov 2001
    Location
    Philippines
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Xml Dom?

    How do I add or write new data or node to my xml document using PHP's XML DOM? I've posted the structure of the xml document below:

    <?xml version="1.0" ?>
    <contacts>
    <contact>
    <fName>Peter</fName>
    <lName>Alvaro</lName>
    <eMail>zp8r2@yahoo.com</eMail>
    </contact>
    <contact>
    <fName>Marylen</fName>
    <lName>De Guia</lName>
    <eMail>marylen_de_guia@yahoo.com</eMail>
    </contact>
    </contacts>

    Thanks

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Load document domxml_open_file
    2. Find parent of new node get_element_by_id
    3. Create new node create_element
    4. Add new node to parent append_child

  3. #3
    web daemon jorasmi's Avatar
    Join Date
    Nov 2001
    Location
    Philippines
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i got this error everytime i run the sample codes from those url.

    Fatal error: Call to undefined function: domxml_open_file() in /var/www/html/!/test.php on line 3

    any suggestion

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably the function is not defined

    See php manual, section requirements/installation
    Or try old function xmldocfile()
    Last edited by jofa; Jun 8, 2002 at 05:19.

  5. #5
    web daemon jorasmi's Avatar
    Join Date
    Nov 2001
    Location
    Philippines
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tried the old functions, they work but whenever i add a new node, it add it in one line instead of a tree


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •