Jump to content

xml Parsing


bilalaslam777

Recommended Posts

Hello Guys,

 

 

i am trying to insert node in xml but its not working as i am newbie in Parsing so please help me. here is the code

 

 

<?php

//how to add new nodes in xml

 

$source='books.xml';

$dom = new DOMDocument();

$dom->load($source);

 

$books = $dom->createElement('books');

$name = $dom->createElement('name');

$text = createTextNode('Adobe Photoshop Beginning Learner');

$name->appendChild($text);

 

$books->appendChild($name);

$dom->documentElement->appendChild($books);

 

echo $dom->saveHtml();

 

?>

Thanks in advance[/][/color]

Link to comment
https://forums.phpfreaks.com/topic/172662-xml-parsing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.