When I try to read an XML document (eagle file) with a DTD, I get an error:
Project xx raised EDOMParserError exception class with message 'DTD is denied
The XML header is as follows:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE eagle SYSTEM "eagle.dtd">
If I delete the second line ...
<!DOCTYPE eagle SYSTEM "eagle.dtd">
... everything is working fine.
After some Google search, it seems that by default the MSXML parser has an option called 'prohibitDTD' equal to true (in earlier versions it was false).
However, it is not possible to set this option to false from the TXMLDocument class. One solution is to recompile the .pas library or create an interface yourself using CoCreateInstance ().
All the examples I saw there are in Delphi, and I have difficulties to pass them to C ++ Builder.
Does anyone know how to read a DTD XML document using C ++ Builder XE2?
My sample code ...
#include <xmldoc.hpp> _di_IXMLNode XMLObject; TXMLDocument *XMLDocument = new TXMLDocument(this); XMLDocument->LoadFromFile(fileName); // <----- Exception EDOMParserError XMLObject = XMLDocument->DocumentElement;
Thanks...
source share