[jdom-interest] trying to validate xml

Gregory S. Hill ghill at vmtllc.com
Thu Jan 13 11:36:56 PST 2005


Hey gang.

I'm trying to validate my xml, using a schema I built, based on a schema 
extracted (using XMLSpy) from a SQL Server database.  I am following the 
instructions in the FAQ on the jdom.org site.  I get an error message, 
and the key passage appears to be this:

".... Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find 
the declaration of element 'Dispatch'."

/Dispatch/ is the root element of my document.  It will look something like:

<?xml version="1.0" encoding="UTF-8"?>
<Dispatch>
    <DispatchID>685</DispatchID>
    <DispatchEmaisUserID>156</DispatchEmaisUserID>
    <DispatchEntered>12/3/2004 9:40:03 AM</DispatchEntered>
    <DispatchStatusItem>
        <ItemID>2033</ItemID>
        <ClassID>218</ClassID>
        <GroupID>0</GroupID>
        <ItemName>Submitted</ItemName>
        <ItemCode>2</ItemCode>
    </DispatchStatusItem>
.
.
.

The schema looks, in part, like this:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2005 sp1 U (http://www.xmlspy.com) by Gregory 
S. Hill (Zoetic Consulting) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:sql="urn:schemas-microsoft-com:mapping-schema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="Dispatch" sql:relation="Dispatch" 
sql:key-fields="lDispatchID" type="Dispatch_Type" />
  <xs:complexType name="Dispatch_Type">
    <xs:sequence>
      <xs:element name="lDispatchID" sql:relation="Dispatch" 
sql:field="lDispatchID" sql:datatype="int">
        <xs:simpleType>
          <xs:restriction base="xs:integer">
            <xs:maxInclusive value="2147483647" />
            <xs:minInclusive value="-2147483648" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="lDispatchEmaisUserID" nillable="true" 
sql:relation="Dispatch" sql:field="lDispatchEmaisUserID" sql:datatype="int">
        <xs:simpleType>
          <xs:restriction base="xs:integer">
            <xs:maxInclusive value="2147483647" />
            <xs:minInclusive value="-2147483648" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
.
.
.

The documents for the above snippets are quite long, so I won't burden 
you with those.  Can you see what I'm doing wrong?  This is my first 
real schema, and am completely willing to own the fact that I may have 
my head up my ass re: doing it right!  Any tips would be greatly 
appreciated.

-greg



More information about the jdom-interest mailing list