Hai folks,
i am using this (http://www.phpclasses.org/package/4-PHP-Arbitrary-XML-parser-.html#description) php class to parse xml eliments.
below function in the class out puts entire xml document.
but i want only it to print the data that resides in the <wp:firstname> tag. For this, i am strugling where to put the condition and how will be the condition.
Function DumpStructure(&$structure,&$positions,$path)
{
//echo "[".$positions[$path]["Line"].",".$positions[$path]["Column"].",".$positions[$path]["Byte"]."]";
if(GetType($structure[$path])=="array")
{
echo "<".$structure[$path]["Tag"].">";
for($element=0;$element<$structure[$path]["Elements"];$element++)
DumpStructure($structure,$positions,$path.",$element");
echo "</".$structure[$path]["Tag"].">";
}
else
echo $structure[$path];
}
Sample xml data
<wp:listing>
<wp:people>
<wp:person>
<wp:firstname>Jeffrey</wp:firstname>Array 0,5,1,1,1,1
<wp:middlename>E</wp:middlename>Array 0,5,1,1,1,3
<wp:lastname>Thompson</wp:lastname>Array 0,5,1,1,1,5
</wp:person>Array 0,5,1,1,1
<wp:person>
<wp:firstname>Kelsey</wp:firstname>Array 0,5,1,1,3,1
<wp:middlename>A</wp:middlename>Array 0,5,1,1,3,3
<wp:lastname>Thompson</wp:lastname>Array 0,5,1,1,3,5
</wp:person>Array 0,5,1,1,3
<wp:person>