[jdom-interest] Do schemas work with JDOM?

Fishman, Rick Rick_Fishman at ctilogistx.com
Fri Jan 19 13:00:49 PST 2001

Does JDOM understand schemas? The xml file below doesn't work. If I run it
without validation, JDom doesn't see any elements. With validation, I get
the following exception:

Root cause: org.jdom.JDOMException: Error on line 1 of document
file:/C:/JavaProjects/JDomTest/ReadTest.xml: General Schema Error: Grammar
with uri : x-schema:ReadTestSchema.xml , can not found.

I've got the schema in the same directory as the xml file. I tried with
'x-schema:http://localhost/ReadTestSchema.xml' after putting the schema in
my default web site and that doesn't work either (same problem).

XML file (ReadTest.xml):

<RICKSDOC xmlns="x-schema:ReadTestSchema.xml">
   <ROUTE ID="1">
      <TRIP ID="1">
         <STOP ID="1" />

Schema file (ReadTestSchema.xml):

<Schema xmlns="urn:schemas-microsoft-com:xml-data">
<AttributeType name="ID" />
<ElementType name="STOP">
   <attribute type="ID" />
<ElementType name="TRIP" >
   <attribute type="ID" />
   <element type="STOP" />
<ElementType name="ROUTE">
   <attribute type="ID" />
   <element type="TRIP" />
<ElementType name="RICKSDOC">
   <element type="ROUTE"/>

More information about the jdom-interest mailing list