Hi,
Some more info on my problem: I have modified my XML file to point directly to
"c:\temp\catalog.dtd" for the systemID. If I hook up my entity resolver to the parser,
then the parsing fails (even though I return NULL from the entity resolver). However,
if I don't hook the entity resolver into the parser, then the parsing succeeds. It
seems that the entity resolver is not quite handling things correctly.
Any help is greatly appreciated.
Thanks,
--Hieu
--
--------- Original Message ---------
DATE: Tue, 23 Sep 2003 10:13:09
From: "Hieu Bui" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc:
>Hi,
>
>Thanks for the tips. I've implemented your code snippet for returning the local DTD
>file as an input source and unfortunately my entity resolver still doesn't seem to
>make a difference. My parser->parse() function still errors out. The local DTD file
>exists and has the correct grammar but I am unsure of what is wrong still.
>
>Any help would be greatly appreciated...
>
>Thanks,
>
>--Hieu
>
>--
>
>--------- Original Message ---------
>
>DATE: Mon, 22 Sep 2003 23:25:44
>From: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Cc:
>
>>
>>
>>
>>
>>You cannot just cast a const char* to a DOMInputSource. Do yourself a
>>favor, and never use another C-style cast again -- it will make your life
>>easier.
>>
>>Try:
>>
>> XMLCh buffer[1024];
>> XMLString::transcode("c:\\temp\\Catalog.dtd", buffer, sizeof(buffer)
>>- 1);
>> return new Wrapper4InputSource( new LocalFileInputSource(buffer));
>>
>>Note also your calls to XMLString::transcode() are leaking memory. You
>>should read the documentation for APIs so you understand how to use them.
>>
>>Dave
>>
>>
>>
>>|---------+--------------------------->
>>| | "Hieu Bui" |
>>| | <[EMAIL PROTECTED]|
>>| | il.com> |
>>| | |
>>| | 09/22/2003 07:41|
>>| | PM |
>>| | Please respond |
>>| | to xerces-c-dev |
>>|---------+--------------------------->
>>
>> >-------------------------------------------------------------------------------------------------------------------------------------|
>> |
>> |
>> | To: [EMAIL PROTECTED], [EMAIL PROTECTED]
>> |
>> | cc: (bcc: David N Bertoni/Cambridge/IBM)
>> |
>> | Subject: Re: FW: FW: Validation against XML schema without internet
>> connection |
>>
>> >-------------------------------------------------------------------------------------------------------------------------------------|
>>
>>
>>
>>Hi Anand,
>>
>>Thanks for the response and the URL for more info. I actually have hooked
>>up my local entity resolver and the parser is calling the function.
>>However, my one last problem is that I cannot seem to point it correctly to
>>my local DTD file. I am finding the systemID and comparing it correctly,
>>I'm just not returning the correct DOMInputSource pointer. Any help would
>>be greatly appreciated!
>>
>>TIA,
>>
>>--Hieu
>>
>>
>>DOMInputSource * LocalDTDResolver::resolveEntity (const XMLCh *const
>>publicId, const XMLCh *const systemId, const XMLCh *const baseURI)
>>{
>> char tempString[1024];
>>
>> sprintf(tempString, "PublicID: %s", XMLString::transcode(publicId));
>> AppendToLogFile(tempString);
>> sprintf(tempString, "SystemID: %s", XMLString::transcode(systemId));
>> AppendToLogFile(tempString);
>>
>> try
>> {
>> if (strcmp(XMLString::transcode(systemId),"
>>http://mydomain.com/lib/Catalog.dtd")==0)
>> {
>> AppendToLogFile("Found external DTD and resolving to local
>>DTD");
>> // Return local copy of the dtd file but this is failing
>> return (DOMInputSource *)("c:\\temp\\Catalog.dtd");
>>
>> }
>>
>> }
>>
>> catch (...)
>> {
>> return NULL;
>> }
>>
>> // If no match, returning null makes process continue normally
>> return NULL;
>>}
>>
>>
>>
>>
>>--
>>
>>--------- Original Message ---------
>>
>>DATE: Mon, 22 Sep 2003 14:49:01
>>From: "Tarkus, Anand (LNG-DAY)" <[EMAIL PROTECTED]>
>>To: Hieu Bui <[EMAIL PROTECTED]>
>>Cc:
>>
>>>Hi Hieu,
>>>You might want to take a look at this page:
>>>http://www-106.ibm.com/developerworks/xml/library/x-tipent.html
>>>Thanks,
>>>Anand.
>>>
>>>-----Original Message-----
>>>From: Hieu Bui [mailto:[EMAIL PROTECTED]
>>>Sent: Monday, September 22, 2003 12:17 PM
>>>To: [EMAIL PROTECTED]
>>>Subject: Re: FW: Validation against XML schema without internet
>>>connection
>>>
>>>Hi,
>>>
>>>I've tried looking at the documentation for DOMEntityResolver and have not
>>>had much luck implementing what I need. Does anyone have any sample code
>>to
>>>use a local version of the DTD (DTD file stored locally) for parsing
>>instead
>>>of the externally referenced DTD?
>>>TIA,
>>>* Hieu
>>>
>>>
>>>--
>>>
>>>--------- Original Message ---------
>>>DATE: Mon, 22 Sep 2003 09:45:32
>>>From: Gareth Reakes <[EMAIL PROTECTED]>
>>>To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>,
>>>"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>>>Cc:
>>>
>>>>Hi,
>>>> there is not an example of this in the samples (if you want to
>>
>>>>write one then that would be great). Take a look at DOMEntityResolver.
>>>>Make your own one of these and the setEntityResolver on your parser. To
>>>>start with you could just print out what the parameters are. Then you
>>will
>>>>need to translate them into where you want to look for the entity.
>>>>
>>>>Gareth
>>>>
>>>>
>>>>On Sun, 21 Sep 2003, Hieu Bui wrote:
>>>>
>>>>> Could you please point me to this example code for the version 2.3.0
>>>distribution? I want to use a local DTD file for parsing even though the
>>XML
>>>refers to a URL for the DTD.
>>>>>
>>>>> Regards,
>>>>>
>>>>> --Hieu
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> --------- Original Message ---------
>>>>>
>>>>> DATE: Thu, 18 Sep 2003 12:00:58
>>>>> From: "Erik Rydgren" <[EMAIL PROTECTED]>
>>>>> To: <[EMAIL PROTECTED]>
>>>>> Cc:
>>>>>
>>>>> >No, all requests for external entities are routed through your entity
>>>>> >resolver. Just have the resolver return an inputstream pointing to a
>>>>> >local file representing the URL. The parser will only try to open the
>>>>> >URL if the entityresolver doesn't provide an inputsource.
>>>>> >
>>>>> >/ Erik
>>>>> >
>>>>> >> -----Original Message-----
>>>>> >> From: Ilan Nehama [mailto:[EMAIL PROTECTED]
>>>>> >> Sent: den 18 september 2003 10:49
>>>>> >> To: [EMAIL PROTECTED]
>>>>> >> Subject: RE: Validation against XML schema without internet
>>>connection
>>>>> >>
>>>>> >> Thanks for the quick response
>>>>> >>
>>>>> >> After writing the EntityResolver that finds the XSD file and attach
>>it
>>>>> >the
>>>>> >> DOMParser, I'll still have http links in my XML and XSD files.
>>>>> >> In the XSD:
>>>>> >> !DOCTYPE xs:schema SYSTEM "
>>http://www.w3.org/2001/XMLSchema.dtd"
>>>>> >[
>>>>> >> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>>> >> elementFormDefault="unqualified">
>>>>> >> In the XML:
>>>>> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> >>
>>>>> >> Should I delete those?
>>>>> >> Aren't them the cause to my problem?
>>>>> >>
>>>>> >> Thanks
>>>>> >> Ilan
>>>>> >>
>>>>> >
>>>>> >
>>>>> >
>>>>> >---------------------------------------------------------------------
>>>>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> >For additional commands, e-mail: [EMAIL PROTECTED]
>>>>> >
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> Need a new email address that people can remember
>>>>> Check out the new EudoraMail at
>>>>> http://www.eudoramail.com
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>
>>>>--
>>>>Gareth Reakes, Head of Product Development +44-1865-203192
>>>>DecisionSoft Limited http://www.decisionsoft.com
>>>>XML Development and Services
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>>
>>>
>>>Need a new email address that people can remember
>>>Check out the new EudoraMail at
>>>http://www.eudoramail.com
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>>
>>
>>Need a new email address that people can remember
>>Check out the new EudoraMail at
>>http://www.eudoramail.com
>>
>>---------------------------------------------------------------------
>>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]
>>
>>
>
>
>
>Need a new email address that people can remember
>Check out the new EudoraMail at
>http://www.eudoramail.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
Need a new email address that people can remember
Check out the new EudoraMail at
http://www.eudoramail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]