You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Fred Harju <fr...@harbellinternet.com> on 2006/02/15 20:57:46 UTC

Xerces-c question

Hi,

Is this the appropriate list to ask a question about Xerces-c?  The 
subscribe on this page is broken:
http://xml.apache.org/mail.html#xerces-c-dev (yes I replaced *.at.* with 
*@*)

No matter, I found this list :)

My question is with setting up a DOMEntityResolver.  I would like to 
validate XML against a schema but I want the source of the schema to be 
a file on the local filesystem because I don't have a network connection.

 From reading the docs I think all I have to do is implement the 
DOMEntityResolver interface then make a call to 
DOMBuilder::setEntityResolver(...) then enable a few features like 
fgDOMNamespaces, fgXercesSchema, fxXercesSchemaFullChecking and 
fgDOMValidation.

I did this but the problem is that it only queries my interface at times 
-- not every time. 

ex: I have a call to DOMBuilder::ParseURI(XMLfile) and I see the path to 
XMLFile go through my interface, which I ignore by returning 0, but the 
schema referenced inside XMLFile doesn't show up.

The root node inside XMLfile looks something like this:

<myrootnode
   xmlns="http://mywebsite"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://mywebsite myschemafile.xsd">
.....
</myrootnode>

What happens is that my validation fails because it couldn't find the 
schema file.

Is there something else I have to do to trap the download of the schema?

The only way I can make it work is by changing XMLfile to look somethign 
like this:

<myrootnode
   xmlns="http://mywebsite"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://mywebsite 
file:///usr/local/files/myschemafile.xsd">
.....
</myrootnode>

Regards,
Fred


Re: Xerces-c question

Posted by Alberto Massari <am...@datadirect.com>.
Hi Fred,
which version of Xerces are you using?

Alberto

At 02:57 PM 2/15/2006 -0500, Fred Harju wrote:
>Hi,
>
>Is this the appropriate list to ask a question about Xerces-c?  The 
>subscribe on this page is broken:
><http://xml.apache.org/mail.html#xerces-c-dev>http://xml.apache.org/mail.html#xerces-c-dev 
>(yes I replaced .at. with @)
>
>No matter, I found this list :)
>
>My question is with setting up a DOMEntityResolver.  I would like to 
>validate XML against a schema but I want the source of the schema to 
>be a file on the local filesystem because I don't have a network connection.
>
> From reading the docs I think all I have to do is implement the 
> DOMEntityResolver interface then make a call to 
> DOMBuilder::setEntityResolver(...) then enable a few features like 
> fgDOMNamespaces, fgXercesSchema, fxXercesSchemaFullChecking and 
> fgDOMValidation.
>
>I did this but the problem is that it only queries my interface at 
>times -- not every time.
>
>ex: I have a call to DOMBuilder::ParseURI(XMLfile) and I see the 
>path to XMLFile go through my interface, which I ignore by returning 
>0, but the schema referenced inside XMLFile doesn't show up.
>
>The root node inside XMLfile looks something like this:
>
><myrootnode
>    xmlns="http://mywebsite"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://mywebsite myschemafile.xsd">
>.....
></myrootnode>
>
>What happens is that my validation fails because it couldn't find 
>the schema file.
>
>Is there something else I have to do to trap the download of the schema?
>
>The only way I can make it work is by changing XMLfile to look 
>somethign like this:
>
><myrootnode
>    xmlns="http://mywebsite"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://mywebsite 
> file:///usr/local/files/myschemafile.xsd">
>.....
></myrootnode>
>
>Regards,
>Fred


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Xerces-c question

Posted by Fred Harju <fr...@harbellinternet.com>.
I'm using libxerces-c.so.26.0 and this suggestion worked perfectly!

Thanks!
Fred


Boris Kolpackov wrote:

>Fred,
>
>Fred Harju <fr...@harbellinternet.com> writes:
>
>  
>
>>Is there something else I have to do to trap the download of the schema?
>>    
>>
>
>You can override schemaLocation in your instance using the
>fgXercesSchemaExternalSchemaLocation property, e.g.,
>
>// Pseudo code.
>//
>
>XMLCh* loc ("http://mywebsite file:///usr/local/files/myschemafile.xsd");
>
>parser->setProperty (
>  XMLUni::fgXercesSchemaExternalSchemaLocation, loc);
>
>
>See API docs for more information.
>
>hth,
>-boris
>
>--
>Boris Kolpackov
>Code Synthesis Tools CC
>www.codesynthesis.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org
>
>
>
>  
>

Re: Xerces-c question

Posted by Boris Kolpackov <bo...@kolpackov.net>.
Fred,

Fred Harju <fr...@harbellinternet.com> writes:

> Is there something else I have to do to trap the download of the schema?

You can override schemaLocation in your instance using the
fgXercesSchemaExternalSchemaLocation property, e.g.,

// Pseudo code.
//

XMLCh* loc ("http://mywebsite file:///usr/local/files/myschemafile.xsd");

parser->setProperty (
  XMLUni::fgXercesSchemaExternalSchemaLocation, loc);


See API docs for more information.

hth,
-boris

--
Boris Kolpackov
Code Synthesis Tools CC
www.codesynthesis.com


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org