[jdom-commits] CVS Update: jdom-contrib/lib

nobody nobody at chimbo.servlets.com
Tue Apr 29 18:07:35 PDT 2003


****************************************
Date:   Tue Apr 29, 2003 @19:07:35 MDT
Author: 

Update of /home/cvs/jdom-contrib/lib
In directory chimbo:/tmp/cvs-serv9604/lib

Added Files:
isorelax.jar isorelax.readme
Log Message:
Contrib schema package from Laurent:

Attached is a proposal for supporting in-memory validation of JDOM documents
against schemas.
This code relies on JARV (Java API for RELAX Verifiers,
http://iso-relax.sourceforge.net/JARV/) and Sun's Multi-Schema Validator
implementation.

To validate a document against a W3C XML Schema definition:

import org.jdom.contrib.schema.Schema;

String uri = <The URL of the schema document>;
Document doc = <a JDOM document>;

Schema schema = Schema.parse(uri, Schema.W3C_XML_SCHEMA);
List errors = schema.validate(doc);
if (errors != null) {
// Validation errors
for (Iterator i=errors.iterator(); i.hasNext(); ) {
ValidationError e = (ValidationError)(i.next());

System.out.println(e);
}
}
// Else: No error, document is valid.

The current limitations are those of JARV, i.e. no support for validating a
document against multiple schemas. This can be work around for elements
(calling validate(Element) on another Schema) but not for attributes.

Regards,

Laurent


===================================================================
File: isorelax.jar     	Status: Up-to-date

   Working revision:	1.1	Wed Apr 30 01:07:32 2003
   Repository revision:	1.1	/home/cvs/jdom-contrib/lib/isorelax.jar,v
   Sticky Options:	-kb

   Existing Tags:
	No Tags Exist

===================================================================
File: isorelax.readme  	Status: Up-to-date

   Working revision:	1.1	Wed Apr 30 01:07:33 2003
   Repository revision:	1.1	/home/cvs/jdom-contrib/lib/isorelax.readme,v

   Existing Tags:
	No Tags Exist




More information about the jdom-commits mailing list