[jdom-interest] Schema Validation Error

John Muhlestein jmuhlestein at i-link.net
Wed Jun 20 09:49:51 PDT 2001


Thanks for looking into this Peter, I have done some more digging and
written some test programs using JDOM from June 15 CVS.  I used this version
in conjunction with Xerces 1.4.0 and found some problems with the design of
my Schema Definition.  It appears that when only SAX events are reported
that the generic exception is "<root element> must be declared.  Following
the stack trace in these other programs, I found that I had some illegally
nested schema tags (elements directly under complexType) and that my
references to model groups that I created were not handled as I would have
expected.  Once I made these fixes I was able to build a JDOM document using
SAXBuilder with validation set to true.

Thanks for the help,

John

-----Original Message-----
From: Peter Henzler [mailto:phenzler at henzler.com]
Sent: Wednesday, June 20, 2001 8:16 AM
To: jmuhlestein at i-link.net; jdom-interest at jdom.org
Subject: AW: [jdom-interest] Schema Validation Error


Hi

I haven't found the cause for the reported mysterious validation error.

Here is what I have found so far:
- xerces 1.4.0 is neaded for proper XML-Schema validation

- I have written a class (see attachment) for validating XML with xerces
alone.

- You must use  xmlns:xsd="http://www.w3.org/2001/XMLSchema" .
  Usage of xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" will result in
errors reported from xerces.

- JDOM can't be used for validation of xml data with schema validation. It
gives error messages where xerces says that there are no errors.

So the workaround is to use for validation a class like the attached one.

Hope this helps.
Peter Henzler


-----Ursprüngliche Nachricht-----
Von: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]Im Auftrag von Peter Henzler
Gesendet: Dienstag, 19. Juni 2001 17:42
An: jdom-interest at jdom.org
Betreff: [jdom-interest] Schema Validation Error


Hi everybody

I have the same problem that John Muhlestein reportet in 'More Schema
Validation'.

Can anyone tell us, what we are doing wrong?
If I validate my XML and XSD Files with my editor XMLSpy there is no
validation error.

Where is the problem?
Please help!

Kind regards
Peter Henzler

henzler informatik gmbh
Teichstrasse 7, CH-4106 Therwil
Tel. +41 (061) 723 23 90
Fax  +41 (061) 723 23 70


-----Ursprüngliche Nachricht-----
Von: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]Im Auftrag von John Muhlestein
Gesendet: Donnerstag, 14. Juni 2001 20:17
An: 'jdom-interest at jdom.org'
Betreff: [jdom-interest] More Schema Validation


I am in the process of converting xml validation from DTD's to Schema and I
am coming up with an error which has me stumped.

XML:

<?xml version="1.0" standalone="yes" ?>
<b2b xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="whlsl3.xsd">
<!--lots-o-content-->...
</b2b>

XMLSchema:

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http:/www.w3.org/2001/XMLSchema">

<xsd:element name="b2b">
  <xsd:complexType>
    <xsd:sequence>
      <!--more definition--> ...
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

ERROR:

**Parsing Error**
  Line: 2
  URI: .../whlsl3.xml
  Message: Element type "b2b" must be declared
Error in parsing: Error encountered

I have actually tried this with the code from Brett's book for
SAXParserDemo.java before running it through JDOM.  Any suggestions
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com

_______________________________________________
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