Re: [xml] parsing output from xmlNodeDump()



On Wed, Sep 08, 2004 at 04:52:18PM -0400, Cory Virok wrote:
Hello all.

Is there a built in way to parse text that contains entity refs for XML 
markup without manually search-and-replacing entities? I need to reparse 
text that has been output by xmlNodeDump().

In my xml document I am storing xml subtrees as encrypted text within 
XML text nodes. My original XML doc looks like this:

<?xml ...?>
<root>
   <secret-stuff>
      <secret-xml>I'm gonna get encrypted!</secret-xml>
   </secret-stuff>
</root>

after encrypting the secret-xml content and making the secret-xml 
subtree a text node via xmlNodeDump() I get something like this:

<?xml ...?>
<root>
   <secret-stuff>
      &lt;secret-xml&gt;ENCRYPTED_TEXT&lt;/secret-xml&gt;
   </secret-stuff>
</root>

Now my question is... is there a built in way to parse the text node so 
that the entity refs are automagically recognized as XML markup?
I realize I can just do the search and replace myself... but I'd like to 
use libXML to do this if I can.

  Seems to me you're mostly making the mistake of dumping <secret-xml>
itself and it subtree instead of dumping its *content* in the first place.
There is now (recently added) xmlParseInNodeContext() which I think
does what you want, but again it's needed only because you xmlNodeDump()
the wrong node !

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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