Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Parsing only part of a document with expat in PHP
- <xmlroot>
- <page id="home">
- <h1>An HTML Header Tag!</h1>
- <p>This is a paragraph</p>
- </page>
- [...etc]
- </xmlroot>
- <?php
- $doc = new DOMDocument('1.0');
- $root = $doc->createElement('html');
- $root = $doc->appendChild($root);
- $head = $doc->createElement('head');
- $head = $root->appendChild($head);
- $title = $doc->createElement('title');
- $title = $head->appendChild($title);
- $text = $doc->createTextNode('< This is the title >');
- $text = $title->appendChild($text);
- echo $head->ownerDocument->saveXML($head);
- <xmlroot>
- <page id="home">
- <![CDATA[
- <h1>An HTML Header Tag!</h1>
- <p>This is a paragraph</p>
- ]]>
- </page>
- [...etc]
- </xmlroot>
Add Comment
Please, Sign In to add comment