Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- <data>
- <menu id="0" tpl="" name="Impressum" link="" target="" secure="">
- <site id="0" tpl="index" name="Datenschutz" link="" target="" secure=""/>
- <site id="1" tpl="index" name="Datenschutz" link="" target="" secure=""/>
- <site id="2" tpl="index" name="Datenschutz" link="" target="" secure=""/>
- </menu>
- </data>
- */
- $doc = new DomDocument;
- // We need to validate our document before refering to the id
- $doc->validateOnParse = true;
- $doc->load('php.xml');
- //header('Content-Type: text/xml');
- //echo $doc->saveXML();
- $sites = $doc->getElementsByTagName('site'); // Find Sections
- foreach ($sites as $site) //go to each section 1 by 1
- {
- if(($name = $doc->documentElement->nodeName) != 'site')
- continue;
- var_dump($name.': '.$site->getAttribute('id'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement