GNOME Bugzilla – Bug 604905
Add possibility to parse import before check if it's a valid URI
Last modified: 2010-01-20 11:45:07 UTC
In file import.c, i would like a entry point to modify URI before called of xmlBuildURI. Actually i use : defaultEntityLoader = xmlGetExternalEntityLoader(); xmlSetExternalEntityLoader(myExternalEntityLoader); to modify the URI. The problem is now my URI (it's not my choice), has the form <xsl:import href="{XXX_XXX}/document.xsl"/>. This document is used with the Oracle parser and {XXX_XXX} is replaced by the good path. I would like parse this stylesheet with my own app, but i have the error (because of { and }): xsl:import : invalid URI reference {XXX_XXX}/document.xsl The method myExternalEntityLoader is never called. How can i change the value of {XXX_XXX} in import and import of import ? I can't remove or replace { and }. Thanks in advance
Well you're asking an XSLt parser to parse something which will become XSLT only after some preprocessing, that's likely to fail. I'm not tempted to make more extension for something like this. You can try to register your own Input handler instead, this may work http://xmlsoft.org/html/libxml-xmlIO.html#xmlRegisterInputCallbacks Daniel
Thanks for the link. Too bad this isn't as convenient that xmlSetExternalEntityLoader (because i must reparse the xml to find import, and replace it). In general, it could be great if i can modify the document structure (XML) before it was parsing by the methode xsltParseStylesheetFile for the file (for this i can use [1]) and it's import (i don't have solution). [1] xmlDocPtr xslDoc = xmlParseMemory( data, data.size() ); d->m_stylesheet = xsltParseStylesheetDoc( xslDoc );
I use xmlRegisterInputCallbacks to pre-parse the file, and that's work as i want, but with a double parsing. Thanks