[jdom-interest] jdom b7 XMLSchema validation

Neil Blue neil.blue at denovopharma.com
Wed Oct 24 03:38:09 PDT 2001


Hello,

I am trying to use XMLSchema validation with JDom b7
I have set up my files as:

contents.xml

<?xml version="1.0"?>
<Book
 xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
<http://www.w3.org/1999/XMLSchema-instance>
 xsi:noNamespaceSchemaLocation="http://cerverous/myschema.xsd" 
<http://cerverous/myschema.xsd>>
 <title>Test string</title>
</Book>

where 'http://cerverous/' is the location of the schema definition file
and my schema as myschema.xsd:


<?xml version="1.0"?>
<schema xmlns="http://www.w3c.org/1999/XMLSchema" 
<http://www.w3c.org/1999/XMLSchema>>
 <element name="Book" type="BookType">
 <complexType name="BookType">
  <element name="title" type="string">
 </complexType>
</schema>


However I consistently get the error:

org.jdom.JDOMException: Error on line 2 of document 
file:/home/neil/jdom/samples/contents.xml: 
<cid:part1.09070300.01080109 at netscape.com> Element type "Book" is not 
declared.
  at org.jdom.input.SAXBuilder.build(SAXBuilder.java:296)
  at org.jdom.input.SAXBuilder.build(SAXBuilder.java:682)
...

Cheers
Neil


More information about the jdom-interest mailing list