Navigate an XML sequentially

FrontRunner

New Member
Please teach me how to navigate an xml with php. Have a look at http://laws-lois.justice.gc.ca/eng/XML/C-42.xml. I made my first attempts to use simplexml_load_file, but what it does is group all the data by tags, which is great at the lower level, but what I need is to preserve some linearity. In other words, once I get inside , I need to know which Section follows which Heading, etc. How would I go about that?\[code\]<?php $url="http://laws-lois.justice.gc.ca/eng/XML/C-42.xml"; $xml=simplexml_load_file($url); echo $xml->Identification->LongTitle; echo "<br>"; foreach ($xml->Body as $hd) { // WHAT DO I DO HERE? }?>\[/code\]
 
Back
Top