parsing nested unbounded XML fields with ElementTree

Larry Martell larry.martell at gmail.com
Mon Nov 25 17:45:09 EST 2013


On Monday, November 25, 2013 5:30:44 PM UTC-5, Chris Angelico wrote:

> On Tue, Nov 26, 2013 at 9:22 AM, Larry.Martell at gmail.com
>
> <Larry.Martell at gmail.com> wrote:
>
> > I have an XML file that has an element called "Node". These can be nested to any depth and the depth of the nesting is not known to me. I need to parse the file and preserve the nesting. For exmaple, if the XML file had:
>
> >
>
> > <Node Name="A">
> >    <Node Name="B">
> >       <Node Name="C">
> >         <Node Name="D">
> >           <Node Name="E">
>
>
>
> First off, please clarify: Are there five corresponding </Node> tags
> later on? If not, it's not XML, and nesting will have to be defined
> some other way.

Yes, there are corresponding </Node> tags. I just didn't show them.

> Secondly, please get off Google Groups. Your initial post is
> malformed, and unless you specifically fight the software, your
> replies will be even more malformed, to the point of being quite
> annoying. There are many other ways to read a newsgroup, or you can
> subscribe to the mailing list python-list at python.org, which carries
> the same content.

Not sure what you mean by malformed. I don't really care for Google
Groups, but I've been using it to post to this any other groups for
years (since rn and deja news went away) and no one ever said my posts
were malformed. In any case, I did not know the group was available as
a ML. I've subbed to that and will post that way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131125/37b70ad4/attachment.html>


More information about the Python-list mailing list