[xml] How to override SystemID in xmlReader?



Hi all,
I am looking for a legal, built-in solution to override the SystemID in an XML document without having to patch the document on-the-fly myself; I want to avoid sting crunching when we have an advanced parser already.

I.e.:
xmlTextReaderPtr _ptrxmlReader=xmlReaderForFile(_sFilename.c_str(), _sEncoding, XML_PARSE_RECOVER, _sNewSystemID);

I know it does not exist, this is just to illustrate what I want to achieve - not necessarily like this, but in way that's already in libxml.

Below, you can find the problem description.

The XML is generated on a machine, where the DTD may be located in, for example: ~/tool/sample.dtd , resulting in:
<!DOCTYPE xmlexport SYSTEM "file:///~/tool/sample.dtd">

The XML may be processed on other machines as well - where the DTD may be located elsewhere (e.g. /bin/tool/sample.dtd) - and then libxml (rightfully) throws an error because it did not find the DTD.
The 'tool' knows its own location, so it could provide the new SystemID to the XML reader.

Any tips?

Could this be added to libxml itself (as new reader constructors)?

Thanks!

Best regards: Zoltán Ördögh



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