Hi Alberto,

This works. I didn't realize that this also works for DOM (with the
corresponding DOMEntityResolver). IMHO the FAQ ist definitely too short...

Many thanks! :)

Michael

Alberto Massari wrote:
> Hi Michael,
> if you use an entity resolver (see the Redirect sample) you can load
> your DTD from any folder you prefer; but Xerces should already try to
> locate mm.dtd from the same folder where the XML is located (unless you
> are using a MemBufInputSource, without setting an appropriate system id
> for it).
> 
> Alberto
> 
> At 13.33 31/05/2007 +0200, Michael Weitzel wrote:
>> Hi,
>>
>> The DOCTYPEs of my XML documents usually specify the name of the DTD
>> without a path name, e.g. <!DOCTYPE measurement SYSTEM "mm.dtd">.
>>
>> As long as the DTD file is found in the current directory validation
>> takes place and the DOM tree is free of additional white space. In case
>> the DTD file is not found, additional white space is added to the DOM
>> tree and my application fails (I'm using
>> DOMText::isIgnorableWhiteSpace()).
>>
>> I have two questions:
>>
>>  1. is there a way to make the absence of the DTD file a hard error?
>>     Xerces should throw an exception of the DTD file is not found.
>>
>>  2. since the binaries of my programs are installed in a system path
>>     (e.g. /usr/local/bin) and application data resides in
>>     /usr/local/share/... it is annoying to be forced to keep the DTD
>>     file in the directory where the parser application is run. It would
>>     be nice to override the document's DTD spec/system Id with a hard
>>     coded one (e.g. /usr/local/share/.../mm.dtd).
>>
>> I made several unsuccessful attempts with DOMReader::loadGrammar() and
>> XMLUni::fgXercesUseCachedGrammarInParse := true.
>>
>> Since my documents are fairly complicated I will probably switch to XML
>> Schema in the near future (in case there is no solution for DTD
>> validation). Please help :-)
-- 

Reply via email to