Hi guys,
i was wondering how to parse XML using php and manipulate the data at the same time. I have been able to parse the xml, but i need to move data from one tag, to a different position.
eg.
<row id ="1">
<url>portal.php</url>
<display_url>http://www.devnetwork.net</display_url>
<title>php forum</title>
<description>this is a php forum</description>
</row>
<row id ="2">
<url>http://www.php.net</url>
<display_url>http://www.devnetwork.net</display_url>
<title>php forum</title>
<description>PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML</description>
</row>
How can i render this xml so that i move the display_url after the description..??
cheers.
manipulating XML
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
XSL would be the cleanest solution. An alternative, and a quite complicated one, would be to use the xpath extension to get the various nodes and then use PHP's XML-DOM functions to generate a new XML document.
That would be so much extra work (for both you and the server) that is worthwhile getting into XSL.
That would be so much extra work (for both you and the server) that is worthwhile getting into XSL.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK