GNOME Bugzilla – Bug 142359
[enhancement] Support the parsing of a string using a node context
Last modified: 2009-08-15 18:40:50 UTC
XML encryption define the types 'http://www.w3.org/2001/04/xmlenc#Content' and 'http://www.w3.org/2001/04/xmlenc#Element' for encrypted data. When using those types, a part of an xml document, either a node or it's content, can be encrypted and later decrypted, the encrypted content replacing the original node or node content with a single EncryptedData node, and the decrypted content replacing the EncryptedData node back with the original content. The original result of the decryption is a string that must be parsed to reinsert it back in the original document. This string is an xml fragment that may in many case not be parsable without the context of the original node. To make it possible to handle this case efficiently and safely, it is desirable to add the possibility to parse a substring within a node context to the libxml2 API.
To some extend xmlParseBalancedChunkMemory() from parser.h does what you want, just that the parser context need to be prepared with the current document set and probably the hierarchy of parent nodes. Daniel
I have just commited support for such a new function: xmlParserErrors xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, int options, xmlNodePtr *lst); which does just this. It should handle namespaces fine, basic tests seems okay so far, please give it a try. The only doubt I have is about adding error reporting, otherwise it should be fine I think. Daniel
I think this is part of libxml2-2.6.12, Daniel
The release of libxml2-2.6.14 should fix this, thanks, Daniel