[jdom-interest] JDOM and XML Schema

Richard Baldwin baldwin at austin.cc.tx.us
Wed May 9 06:03:09 PDT 2001


Well, I solved the second problem listed below by
replacing the xerces.jar file (v1.2.0) that came with
the JDOM download with a new xerces.jar file containing
v1.3.0.  After I did that, schema validation for the
two simple files shown below worked OK.  (Thanks to
Larry Davies for that suggestion.)

However, I'm still interested in the answer to question
1 below.

Dick Baldwin
============

Richard Baldwin wrote:
> 
> 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
> anything.
> 
> 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
> http://www.somedummyurl
> 
> File Schema001.xml
> <?xml version="1.0"?>
> <book xmlns="http://www.somedummyurl"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation=
> "http://www.somedummyurl Schema001.xsd">
> This is a string
> </book>
> 
> File Schema001.xsd
> <?xml version="1.0"?>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
> targetNamespace="http://www.somedummyurl"
> xmlns="http://www.somedummyurl"
> elementFormDefault="qualified">
> <xsd:element name="book" type="xsd:string"/>
> </xsd:schema>
> 
> What am I doing wrong?
> Thanks,
> 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
> http://www.geocities.com/Athens/7077/scoop/onjava.html
> 
> Professor of Computer Studies
> Austin Community College
> (512) 223-4758 or (512) 250-8682
> mailto:baldwin.richard at iname.com
> http://www2.austin.cc.tx.us/baldwin/
> ---------------------------------------------------------
> _______________________________________________
> 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
http://www.geocities.com/Athens/7077/scoop/onjava.html

Professor of Computer Studies
Austin Community College
(512) 223-4758 or (512) 250-8682
mailto:baldwin.richard at iname.com  
http://www2.austin.cc.tx.us/baldwin/
---------------------------------------------------------



More information about the jdom-interest mailing list