Re: [xml] Getting Node content with markup

On Sun, Aug 31, 2003 at 01:52:46PM -0400, Ben Gamari wrote:

I am implementing a python library to modify an XML-based documentation 
format which must be able to handle XML such as this:
     <Function name="foo">
       <Description>The function <FuncName>foo</FuncName> modifies the 
variable <VarName>bar</VarName> etc.</Description>
Instead of creating classes for the <FuncName> and <VarName> elements I 
would like to pass the inner xml of the <Description> element directly 
to the user. I'm using the tree API and haven't found a suitable 
function. However, when I was looking at the XMLReader API I found the 
xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml functions but 
unfortunately they are unimplemented. If I have to I could write code 
to reconstruct the tags from the tree but I would much rather not have 
to undo the work of the parser. Does anyone know of a way to get the 
inner xml of an element with the tree api or know if and when this will 
be implemented. I might be able to donate an implementation if you are 
interested in it.

  have you tried node.serialize() ? see python/tests/ for
a full set of examples. If operated at the reader level you will have
to get it to Expand() first ...


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]