Any particular reason why you're not using php 5 simplexml, it's just so much easier to work with IMO.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Because the original work was done using DOM and the spec has changed and I need to support the change without rewritting the entire 1000 lines of code.
Then rewrite those functions/classes using simpleXML
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
test.xml
<root>
<SpecialParameter>Some Text</SpecialParameter>
<SpecialInfo someNumber="123456789"></SpecialInfo>
<book>
<title>Rusty Bedsprings</title>
<author>I. P. Knightly</author>
</book>
<book>
<title>Rush To The Out House</title>
<author>Willie Makeit</author>
</book>
</root>
I cleaned up your sample xml file so it is legittest.php
<?php
$doc = new DOMDocument();
$doc->load( 'test.xml' );
$sp = $doc->getElementsByTagName( "SpecialParameter" );
$directive = $sp->item(0)->nodeValue;
$si = $doc->getElementsByTagName( "SpecialInfo" );
$blah = $si->item(0)->getAttribute('someNumber');
echo $directive;
echo '';
echo $blah;
?>
Output
Some Text
123456789
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439