Have you considered using 'SimpleXML functions' or 'DOM functions' (not 'DOM XML functions'; they are old and klunky) to do it? They are simpler (particularly--you guessed it--SimpleXML). I can post you a brief example if you like, but you may well have no trouble. CC me personally if you want the example as I may not see a reply on the mailing list.

Ben.



Don Don wrote:
I am reading the following xml data in a very large file using XML reader, the 
xml structure looks like the xample given below

<item>
    <engine>head</engine>
    <brake>tail</brake>
    <tires>head</tires>
        <chromes>part head 1</chromes>
        <chromes>Part head 2</chromes>
    <seats>tail</seats>
</item>
<item>
    <engine>head</engine>
    <brake>tail</brake>
    <tires>head</tires>
        <chromes>part head 1</chromes>
        <chromes>Part head 2</chromes>
    <seats>tail</seats>
</item>

I can read all elements apart from the sub elements under <tires> and am kind 
of looking for a way to read these sub elements.  I am using the code structure below

$reader = new XMLReader();
$reader->open($feedUrl);

while($reader->read())
{
switch($reader->nodeType)
    {
        case(XMLREADER::ELEMENT):
if($reader->localName == "engine")
        {
            echo $reader->value;
        }
        if($reader->localName == "brake")
        {
            echo $reader->value;
        }
        if($reader->localName == "tires")
        {
            echo $reader->value;
            //I FIGURE OUT THAT I SHOULD BE ABLE TO READ THE SUB ELEMENTS HERE 
BUT TRYING TO FIGURE IT OUT
        }
    }
}


Any thoughts ?


Cheers
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to