[jdom-interest] JDOM and XML Schema

Richard Baldwin baldwin at austin.cc.tx.us
Tue May 8 21:32:03 PDT 2001

Two related questions:

1.  It seems necessary to invoke new SAXBuilder(true)
to turn validation on with JDom.  What is the purpose
of the method in the SAXBuilder class named
setValidation(boolean validate)?  It doesn't seem to do

2.  I can validate the following XML file named
Schema001.xml against the schema file named
Schema001.xsd using a validator derived from xerces
1.3.0 (based on validate.bat in example01 from Roger L.
Costello's, XML Schema Tutorial at
http://www.w3.org/XML/Schema).  I know that validation
is working, because I can corrupt the XML file and
cause validation errors.

When I try to process Schema001.xml with a simple
printing program written using JDOM, I get a screen
full of validation errors, complaining about

File Schema001.xml
<?xml version="1.0"?>
<book xmlns="http://www.somedummyurl"
"http://www.somedummyurl Schema001.xsd">
This is a string

File Schema001.xsd
<?xml version="1.0"?>
<xsd:element name="book" type="xsd:string"/>

What am I doing wrong?
Dick Baldwin

philip.nelson at omniresources.com wrote:
> > Does JDOM B6 support validation using XML Schema?
> > --
> No and Yes.  No JDOM doesn't "support" it because jdom uses underlying
> parsers like xerces for that.  Yes it does support it to the extent that the
> underlying parser does.  At the present time, basically no parsers fully
> support xml schema but it should be coming "real soon now".
> :-)
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

Richard G. Baldwin (Dick Baldwin)
Home of Baldwin's on-line Java Tutorials

Professor of Computer Studies
Austin Community College
(512) 223-4758 or (512) 250-8682
mailto:baldwin.richard at iname.com  

More information about the jdom-interest mailing list