[jdom-interest] XML Schema validation.

Beyerly, Robert Robert.Beyerly at brooks.com
Thu Jan 24 08:53:40 PST 2002


Your code looks fine.  Try putting xerces before JDOM in your classpath.

-----Original Message-----
From: Damien Dudouit [mailto:damien at ssl.co.uk]
Sent: Thursday, January 24, 2002 5:47 AM
To: jdom
Subject: [jdom-interest] XML Schema validation.


Hello,

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,

Damien

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

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

---mydoc.xml---
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<book isbn="0836217462"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="myschema.xsd">
<title>Being a Dog Is a Full-Time Job</title>
<author>Charles M. Schulz</author>
</book>

---myschema.xsd---
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.

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list