Almost perfect. The xml is created by code I have nothing to do with, so I
left the actual document alone and passed the file name to the parser with
'file:///' prepended. Works like a charm
Thanks very much,
Adam Read
|---------+---------------------------->
| | "Jesse Pelton" |
| | <[EMAIL PROTECTED]> |
| | |
| | 03/02/2005 05:58 |
| | PM |
| | Bitte antworten |
| | an xerces-c-dev |
| | |
|---------+---------------------------->
>------------------------------------------------------------------------------------------------------------------------------|
|
|
| An: <xerces-c-dev@xml.apache.org>
|
| Kopie:
|
| Thema: RE: Problems using SYSTEM dtd with xerces-c-2_4_0
|
>------------------------------------------------------------------------------------------------------------------------------|
"file:///c:/template/TestCaseReport_V1.0.dtd" should work (note the
additional forward slash). At least, this format works for locating
schemas specified in an element's schemaLocation in Xerces 2.5.
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 03, 2005 11:25 AM
> To: xerces-c-dev@xml.apache.org
> Subject: Problems using SYSTEM dtd with xerces-c-2_4_0
>
>
>
>
>
> Hello,
>
> I'm having problems using XercesDOMParser to parse a document with the
> following prolog:
>
> <?xml version='1.0' encoding='UTF-8'?>
> <!DOCTYPE TCR_Root SYSTEM 'c:/template/TestCaseReport_V1.0.dtd'>
>
> I set up the parser, call parse, and I end up with an exception:
> xercesc_2_4::MalformedURLException.
>
> My set up code:
>
> static XercesDOMParser::ValSchemes gValScheme =
> XercesDOMParser::Val_Auto;
>
> . . .
>
> String CDOMParser::searchTag(const char* sXmlFile, string
> sSearchedNode,
> string sSearchedAttribute)
> {
> m_sSearchedNodeName = sSearchedNode;
> m_sSearchedAttributeName = sSearchedAttribute;
> m_sReturnSearchTag = "";
>
> // Initialisation
> gDoNamespaces = true;
> gDoSchema = true;
> gSchemaFullChecking = false;
> gDoCreate = false;
>
> CXercesInit oXercesInit;
>
> XercesDOMParser *parser = new XercesDOMParser;
> parser->setValidationScheme(gValScheme);
> parser->setDoNamespaces(gDoNamespaces);
> parser->setDoSchema(gDoSchema);
> parser->setValidationSchemaFullChecking(gSchemaFullChecking);
> parser->setCreateEntityReferenceNodes(gDoCreate);
>
> CDOMTreeErrorReporter *errReporter = new CDOMTreeErrorReporter();
> parser->setErrorHandler(errReporter);
>
> try
> {
> parser->parse(sXmlFile);
> }
> . . .
>
> I've followed xerces through with the MSVC7 debugger, and it
> would seem
> that eventually ReaderMgr::createReader() tries to create an
> XMLURL using:
>
> XMLURL::XMLURL(const XMLCh* const baseURL
> , const XMLCh* const relativeURL
> , MemoryManager* const manager)
>
> baseURL == path to the document being parsed
> relativeURL == path to the dtd
>
> This constructor calls XMLURL::setURL(const XMLCh* const
> baseURL, const
> XMLCh* const relativeURL)which calls XMLURL::parse(const XMLCh* const
> urlText), which throws the exception when it sees urlText is
> a path. I've
> tried adding 'file://' to the beginning of the path, but that
> just crashes
> at the ':' trying to figure out port numbers. Relative paths
> don't work as
> sometimes the app will be running from a different drive than
> the dtd is
> on. Besides, even if the dtd is a relative path, I end up
> with exactly the
> same problem later on with the document being parsed, after
> LocalFileInputSource takes out the '..'s and puts in the d:\.
>
> I'm really at a loss, and any help would be appreciated.
>
> Thanks,
>
> Adam Read
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]