[jdom-interest] trying to validate xml
Michael Kay
mike at saxonica.com
Thu Jan 13 15:52:36 PST 2005
I don't think the problem is with your schema or source document. It's
something to do with the code controlling the validation - but I don't know
what. I've had enormous trouble with the Xerces validation API myself. You
may find the new JAXP 1.3 interfaces easier (or, dare I say it, the Saxon
schema processor, which supports the JAXP interfaces).
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: jdom-interest-bounces at jdom.org
> [mailto:jdom-interest-bounces at jdom.org] On Behalf Of Gregory S. Hill
> Sent: 13 January 2005 23:03
> To: Mahesh Trikannad
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] trying to validate xml
>
> Mahesh,
>
> According to a Schema book that I've been working from, no.
> But I may
> be reading it wrong. Doing it as you suggest, what would the
> beginning
> of my schema look like?
>
> -greg
>
> Mahesh Trikannad wrote:
> > Shouldnt the Element Dispatch be a complex type , containing other
> > complex or simple elements
> >
> >
> >
> > Regards
> >
> >
> >
> > Mahesh
> >
> > >From: "Gregory S. Hill" <ghill at vmtllc.com>
> > >To: "jdom-interest at jdom.org" <jdom-interest at jdom.org>
> > >Subject: [jdom-interest] trying to validate xml
> > >Date: Thu, 13 Jan 2005 14:36:56 -0500
> > >
> > >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
> > >
> > >_______________________________________________
> > >To control your jdom-interest membership:
> >
> >http://www.jdom.org/mailman/options/jdom-interest/youraddr@yo
> urhost.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@you
> rhost.com
>
More information about the jdom-interest
mailing list