commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trent_mcclena...@mlc.com.au
Subject Re: [Digester] using Schema Validation
Date Wed, 28 Apr 2004 23:30:10 GMT




G'day Reidar,

I've had the exact problem, but it was a while back now, and I'm struggling
to remember the solution, but here goes:

By default the digester uses the schema language that you are nominating.
I'm pretty sure that I was getting the problem because I was using a Xerces
v1 parser.  If you use a Xerces v2 parser then you should be right to go.

But be careful if you're using this parser within a web application as most
often you will end up using the parser of the application server that you
are deploying to because of the classloader policy.  So even if you ship a
Xerces v2 parser in your WEB-INF/lib directory, it will most likely not be
used, in preference for the application server's parser.  You can configure
application server's classloaders plus other stuff, but thats another
discussion all on its own!

Cheers,
Trent



|---------+---------------------------->
|         |           "Thyr"           |
|         |           <Thyr666@compuser|
|         |           ve.de>           |
|         |                            |
|         |           29/04/2004 06:45 |
|         |           Please respond to|
|         |           "Jakarta Commons |
|         |           Users List"      |
|         |                            |
|---------+---------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                        |
  |       To:       <commons-user@jakarta.apache.org>                              
                                              |
  |       cc:                                                                            
                                        |
  |       Subject:  [Digester] using Schema Validation                                   
                                        |
  >-------------------------------------------------------------------------------------------------------------------------------|




Hello,

I have searched the mailing archive and found that Schema Validation
using Digester is also a problem to others. But all the answers did not
help me getting digester use my schema to validate the xml-file.

I use the following code (and tried variations of it):

Digester digester = new Digester();
digester.setValidating(true);
digester.setNamespaceAware(true);
digester.setSchemaLanguage("http://www.w3.org/2001/XMLSchema");
digester.setSchema("aSchema.xsd");
digester.parse(new File("schemaTest.xml"));

Other tools tell me, the schema is correct and the xml-file corresponds
to it.
Unfortunately Digester says, that nothing is correct:

WARNUNG: org.xml.sax.SAXNotRecognizedException: Property:
http://java.sun.com/xml/jaxp/properties/schemaLanguage
And additionally I get at every node a Parse Error, which tells me the
node isn't declared.

Thank you for any help.

Regards,
Reidar


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message