TDOMParser DTD handling

Hi,

I have a question about XML parsing.

I have a program that uses TDOMParser to parse configuration XML files. I have a DTD file that defines how the configuration files should look. Right now I have both the configuration files and the DTD file in the same directory. This way the parser finds the DTD file correctly as it is configured in the header of the configuration XML.

And here is the question: Would it be possible to put the DTD file somewhere in a central location where my program could find it and I wouldn’t need to copy it to every place where I have a configuration file? There is such a possibility with XercesC, but of course I don’t expect ROOT to have the same amount of features as XercesC…

So, is there a way that I could do it? I couldn’t find any hints about it in the documentation, or using Google…

Cheers,
Attila

The xmlparser classes are a small layer on to of libxml2. The behaviour is more or less what libxml2 supports. At the moment I’ve no time to look in more detail into it as I am leaving on a trip. Check the libxml2 doc.

Cheers, Fons.

Hi, Attila

I am not an expert in libxml2 - I was using it some time ago.

First of all, I recommend to look here: http://xmlsoft.org/xmldtd.html

There is a small description “How to reference a DTD from a document”.
As I see, you should either provide full path (or URL) to your DTD, or try to use magic word PUBLIC in DOCTYPE definition. I personally did not found any hints where these default location situated :frowning: - you should try to find it yourself.

Regards,
Sergey

Hi,

Thanks for the replies. As I noted, I’ve already done such things with Xerces, so at least had an idea what to look for in the library. Thanks for pointing me to libxml2. Usually resolving external files is done by plugging a user function/class into the framework that does the “file finding”. I’ve found something similar in this library as well, under xmlsoft.org/html/libxml-parser.h … itySAXFunc.

Although it’s not yet clear how to use it, I’ll try playing with it.

Cheers,
Attila

Please let us know when you find a solution. :wink:

Cheers, Fons.