Re: Better Solution needed!
| From: | Matt McClanahan | Date: | Tue, 21 Nov 2000 18:47:06 +0000 |
| Subject: | Re: Better Solution needed! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26489@lists.php.net to get a copy of this message | ||
On Tue, 21 Nov 2000, callen wrote:
> Hola:
>
> Currently I am utilizing an if statement based upon count of the number
> of tags parsed in xml data to determine if I have reached
> the right tag. The tag <CMDTYCLASS> comes up 2 times in the same
> documnet with different values. Furthermore, each CMDTYCLASS is encased
> by a seperate ITEM tag: such that the xml looks like this:
>
> <Item>
> <CmdtyClass>100</CmdtyClass>
> <Weight unit="lbs">245</Weight>
> <Rate currency="USD">48.49</Rate>
> <Charge currency="USD">118.80</Charge>
> </Item>
>
> <Item>
> <CmdtyClass>200</CmdtyClass>
> <Weight unit="lbs">245</Weight>
> <Rate currency="USD">96.98</Rate>
> <Charge currency="USD">237.60</Charge>
> </Item>
>
>
> The code that I use looks like this:
Why not build an array of CmdtyClass values? When your endElement
function comes across a </CmdtyClass>, it can append that to the array.
Or for something more useful, you could build an array for each Item
element and its contents.
Matt