Depending on what you are doing, what I like to do is read the file in as a DOMDocument and then you can perform <a href="http://www.w3schools
<modules>
<module id='A'>
<article id=1>
<name>foo</name>
<url>bar.com</url>
</article>
</module>
...
</modules>
$xml = file_get_contents('file.xm
$doc = DOMDocument::loadXML($xml)
$xpath = new DOMXpath($doc);
$modules = $xpath->query("//module");
foreach($modules as $cur){
print $cur->getAttribute('name')
$xpath2 = new DOMXpath($cur);
$articles = $xpath2->query("//article"
foreach($articles as $cur2){
$name = $cur2->getElementsByTagNam
$url = $cur2->getElementsByTagNam
...
}
}
I had to change some of the code from what we are using it for, but this should serve the general purpose.
Main Topics
Browse All Topics





by: gerodimPosted on 2005-11-08 at 03:29:45ID: 15246440
Try changing the parser... I recommend that you use the simplexml set of php5