[jdom-interest] XML Schema validation.

Damien Dudouit damien at ssl.co.uk
Thu Jan 24 05:46:33 PST 2002


I'm using JDom-b7 and a reccent version of Xerces. JDom is great, DTD
validation works perfect. I'm now trying to do schema valiation but in
vain. I know that many times this question have been asked on this
list and that it should work. It sounds I'm doing something wrong. As
it is a couple of lines, could someone confident with validation point
me what's wrong. The parser attemps a validation but no grammar is
available. I have read dozens of time my schema declaration in
mydoc.xml and I'm really driving crazy.

Thanks a lot,


---error msg---
Element 'book' must be declared.

---my code---
org.jdom.input.SAXBuilder builder = new SAXBuilder();
org.jdom.Document doc = builder.build("mydoc.xml");

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<book isbn="0836217462"
<title>Being a Dog Is a Full-Time Job</title>
<author>Charles M. Schulz</author>

The schema is in at the same place. The problem can't come from it. If
I had the line '<!DOCTYPE book SYSTEM "mydtd.dtd">' in mydoc.xml,
validation occurs.

More information about the jdom-interest mailing list