Hello 

Scenario: I have a local dtd on my system and I'm running my code in the same 
directory as the dtd. I thought Xerces would look for the dtd relative to the 
current directory or if an absolute path is specified, use it. 
 
I have an xml file specified as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mpd SYSTEM "mpdjpl03.dtd" [
<!ENTITY E67895 SYSTEM "E67895.tif" NDATA ccitt4>
<!ENTITY W28741 SYSTEM "W28741.tif" NDATA ccitt4>
<!ENTITY W28833 SYSTEM "W28833.tif" NDATA ccitt4>
.... Rest of xml file


I've generated code as follows:

    try
    {
                //The parser should use the default DTD called out in the XML 
file 
                //by the DOCTYPE declaration to resolve external ENTITY's  
                //------------- Example given below ------------- 
                //<!DOCTYPE mpd SYSTEM "mpboe03.dtd" [
                //<!ENTITY E67895 SYSTEM "E67895.tif" NDATA ccitt4>
                //<!ENTITY W28741 SYSTEM "W28741.tif" NDATA ccitt4>
                
                //Turn on the necessary features to allow validation by an 
internal DTD
              //Val_Auto   - turn on validation only if an internal/external 
DTD subset has been seen!!
                _XmlDOMParser->setValidationScheme(_XmlDOMParser->Val_Auto);
                _XmlDOMParser->setDoSchema(false);
            _XmlDOMParser->parse(xmlDoc);
    }
    catch(....ALL EXCEPTIONs)
 
Results: I get the following Exception even though the permissions on the dtd 
is 777
"Parser Error Message: An exception occurred! Type:RuntimeException, 
Message:Could not open DTD file 'mpboe03.dtd'"

What must I do (syntax or SAX feature) for Xerces to locate the dtd?

Reply via email to