[Tutor] xml parsing
Isaac Hall
hall@ouhep1.nhn.ou.edu
Fri Nov 22 11:01:02 2002
hi Alan,
On Fri, 22 Nov 2002 alan.gauld@bt.com wrote:
> (ie. where there is no separate matching </mmm> tag.)
> It might work I just haven't tried it or looked closely enough
> to be sure.
>
Yes, I know this does not handle all types of XML tags, but for the job
that I do, this handles all that I need. I recieve numerical data nested
in XML, and all data have a name. there are no attributes. However this
does not handle one thing that I need it to, and that is repeated tag
names within the same directory. My plan is to make a list for any
repeated tags (for instance):
<block><item>1</item><item>2</item><item>3</item></block>
would give
{block:{item:[1,2,3]}}
but this is not in there yet.
Perhaps if I knew more about general XML then I could make this a more
general thing, but I only know about the type of data I wish to read.
> > item=item=XMLstring[XMLstring.find('>')+1:XMLstring.find('</'+
> > key+'>')]
>
> Is this a bug? or did you mean to have item=item=...
>
yes, this was a copy and paste mistake....sorry
> > This doesn't seem to be the fastest thing ever, but it does the job.
> > comments anyone? could this possibly be 'useless python'?
>
> Definitely good for Useless I think.
>
> Alan G.
>
Thanks for comments
Ike
--