commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reidar Hörning <Thyr...@compuserve.de>
Subject Re: [Digester] using Schema Validation
Date Mon, 31 May 2004 13:08:19 GMT
Hello Testa,

as Simon and Trent said schema validation could work this way:

1. download the Xerces v2 parser and put xercesImpl.jar into the
Classpath
2. configure the parser (example)

static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";

SAXParserFactory factory =
  SAXParserFactory.newInstance();
factory.setValidating(true);

SAXParser parser = factory.newSAXParser();
parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
parser.setProperty(JAXP_SCHEMA_SOURCE, new File("Your xsd"));

3. create digester

Digester d = new Digester();

4. configure digester at your needs

5. parse and digest
parser.parse(new FileInputStream(new File("Your xml")), d);

Regards
Reidar 

-----Ursprüngliche Nachricht-----
Von: José Antonio Pérez Testa [mailto:japtesta@indra.es] 
Gesendet: Montag, 31. Mai 2004 13:50
An: Jakarta Commons Users List
Betreff: [Digester] using Schema Validation


Hi Thyr,
Could you explain me the changes you made.
I'm trying to configure Digester to do schema validation with xerces and

java 1.4

TIA,
Testa

---------------------------------------------------------------------

Hello,

and much thanks to all for your fast and convenient help. After some 
trouble with changing the underlying parser and refactoring
the code, schema validation finally works fine.

Kind Regards
Reidar


---------------------------------------------------------------------
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