Hello, i have a problem witch i think it's verry easy for someone who knows some XML.
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<?php
$xml = simplexml_load_file("test.xml");foreach ($xml->children() as $child)
{
echo "Child node: " . $child . "<br />";
}
?>
This outputs perfect.
But what i want to do is this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test>
<note1>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note1>
<note2>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note2>
</test>
From the root test i want to output only <test1> or <test2>.
Can anyone please help ?
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<?php
$xml = simplexml_load_file("test.xml");foreach ($xml->children() as $child)
{
echo "Child node: " . $child . "<br />";
}
?>
This outputs perfect.
But what i want to do is this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test>
<note1>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note1>
<note2>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note2>
</test>
From the root test i want to output only <test1> or <test2>.
Can anyone please help ?