xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Pelton" <...@PKC.com>
Subject RE: Hints on registering an XMLEntityResolver handler
Date Mon, 30 Apr 2007 18:48:44 GMT
You may also want to take a look at DOMPrint.  It's roughly equivalent
to SAX2Print but uses DOM APIs instead of SAX 2. 

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Monday, April 30, 2007 2:38 PM
To: c-users@xerces.apache.org
Subject: Re: Hints on registering an XMLEntityResolver handler

Emmanuel Guiton wrote:
> Hello,
> I want to force an XML document validation using an XML Schema.
> I am trying to register an XMLEntityResolver handler to do that (Iam
> suing a DOMParser). Quite difficult for a beginner like me since the
> documentation on http://xml.apache.org/xerces-c/apiDocs is wrong.

The C++ documentation is generated from the source code using Doxygen,
so I 
don't know what you mean by saying it's "wrong."  Is it out-of-date?
it not answer your questions?  It's always helpful to know what's wrong,
we can fix it.

> Does someone have good hints (a webpage with an example?) on how to
> register an XMLEntityResolver handler?

You cannot force validation using an XMLEntityResolver, although you can

force the parser to use a particular schema document or documents.  Can
describe exactly what you're doing?  For example, users often forget to
all of the options necessary for schema validation.

> Or does someone have a simpler way to validate an XML file against an
> XML schema (which is stored on my local filesystem)? I've tried using
> setExternalSchemaLocation without any success.

As long as the document element contains a reference to the schema
hint you provided, and the proper options are set, it should work.  Have

you taken a look at the sample applications to see how to enable 
validation?  SAX2Print is a good place to start.

Another option for forcing validation against a particular schema is to
the proprietary loadGrammar() API.  You can then set the feature to use
cached grammar during parsing:



View raw message