Re: lxml: traverse xml tree and retrieve element based on an attribute

2009-05-30 Thread Stefan Behnel
byron wrote: > I am using the lxml.etree library to validate an xml instance file > with a specified schema that contains the data types of each element. > This is some of the internals of a function that extracts the > elements: > > schema_doc = etree.parse(schema_fn) > schema = e

Re: lxml: traverse xml tree and retrieve element based on an attribute

2009-05-21 Thread byron
On May 21, 8:27 pm, MRAB wrote: > byron wrote: > > [snip] > > > Thanks. Yes i tried something like this, but I think I overwrite `c` > > when i wrote it, as in: > > >     if len(c) > 0: > >         c = fin_node(c, name) > >         if c is not None: > >             return c > > FYI, doing that won

Re: lxml: traverse xml tree and retrieve element based on an attribute

2009-05-21 Thread MRAB
byron wrote: [snip] Thanks. Yes i tried something like this, but I think I overwrite `c` when i wrote it, as in: if len(c) > 0: c = fin_node(c, name) if c is not None: return c FYI, doing that won't actually matter in this case; 'c' will still be bound to the n

Re: lxml: traverse xml tree and retrieve element based on an attribute

2009-05-21 Thread byron
On May 21, 6:57 pm, MRAB wrote: > byron wrote: > > I am using the lxml.etree library to validate an xml instance file > > with a specified schema that contains the data types of each element. > > This is some of the internals of a function that extracts the > > elements: > > >         schema_doc =

Re: lxml: traverse xml tree and retrieve element based on an attribute

2009-05-21 Thread MRAB
byron wrote: I am using the lxml.etree library to validate an xml instance file with a specified schema that contains the data types of each element. This is some of the internals of a function that extracts the elements: schema_doc = etree.parse(schema_fn) schema = etree.XMLSche

lxml: traverse xml tree and retrieve element based on an attribute

2009-05-21 Thread byron
I am using the lxml.etree library to validate an xml instance file with a specified schema that contains the data types of each element. This is some of the internals of a function that extracts the elements: schema_doc = etree.parse(schema_fn) schema = etree.XMLSchema(schema_doc)