You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Todd Kessler <TK...@DoveBid.com> on 2000/08/23 01:56:50 UTC

Using Schema with Xerces Parser

I am looking for a Schema FAQ or code examples that detail how to validate
XML against a Schema using the Xerces parser. I am attempting to use the
Xerces Parser and validate with a XDR or Biztalk type schema.

Tod Kessler
www.DoveBid.com

RE: Using Schema with Xerces Parser

Posted by rsanford <rs...@nolimitsystems.com>.
i also started out with a schema that i converted from a dtd but
the conversion ended up a little odd and i was getting errors
saying that my elements had to be declared. it ended up that all
of my primary elements were not declared as top-level elements
and could not be used as the root element of a document. 

i don't understand your error but somebody else on the list
probably does.

rjsjr

> -----Original Message-----
> From: ubik@email.nist.gov [mailto:ubik@email.nist.gov]On Behalf Of
> Christophe D. Laprun
> Sent: Wednesday, August 23, 2000 9:56 AM
> To: xerces-j-dev@xml.apache.org
> Subject: Re: Using Schema with Xerces Parser
> 
> 
> rsanford wrote:
> > 
> > for schema faqs check out
> >    http://www.w3.org/TR/xmlschema-0/
> > 
> > i was having a _lot_ of problems getting schema validation to work
> > and discovered that my schema was not properly formed. very nice
> > read.
> 
> Well, I'll check it in greater details but I have been using dtd2xsd to
> convert from a DTD to a schema and have the resulting schema validated
> by W3C validator but I keep getting weird errors with xerces 1.1.3 (in
> particular: Schema error:  complexType '#9' with a elementOnly or mixed
> content need to have at least one particle child.). I don't use anything
> fancy AFAIK since it is straight from DTD.
> 
> Chris
> 
> -- 
> Christophe Laprun    [Ingenieur ISIMA, France / Guest researcher @NIST]
> web: http://www.nist.gov/speech/staff/laprunch.htm
> email: chris.laprun@nist.gov
> phone: (301) 975 3191             fax: (301) 670 0939
> --
> The universe seems neither benign nor hostile, merely indifferent -
> Sagan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
> 

Re: Using Schema with Xerces Parser

Posted by "Christophe D. Laprun" <ch...@nist.gov>.
rsanford wrote:
> 
> for schema faqs check out
>    http://www.w3.org/TR/xmlschema-0/
> 
> i was having a _lot_ of problems getting schema validation to work
> and discovered that my schema was not properly formed. very nice
> read.

Well, I'll check it in greater details but I have been using dtd2xsd to
convert from a DTD to a schema and have the resulting schema validated
by W3C validator but I keep getting weird errors with xerces 1.1.3 (in
particular: Schema error:  complexType '#9' with a elementOnly or mixed
content need to have at least one particle child.). I don't use anything
fancy AFAIK since it is straight from DTD.

Chris

-- 
Christophe Laprun    [Ingenieur ISIMA, France / Guest researcher @NIST]
web: http://www.nist.gov/speech/staff/laprunch.htm
email: chris.laprun@nist.gov
phone: (301) 975 3191             fax: (301) 670 0939
--
The universe seems neither benign nor hostile, merely indifferent -
Sagan

RE: Using Schema with Xerces Parser

Posted by rsanford <rs...@nolimitsystems.com>.
for schema faqs check out
   http://www.w3.org/TR/xmlschema-0/

i was having a _lot_ of problems getting schema validation to work
and discovered that my schema was not properly formed. very nice
read.

this will show you how to specify that your document is using a
schema and the location of the schema. i think the examples show
only a relative offset to the xml document location so you will
want to know that you may need to specify the offset using URL
(URI?) notation such as:
   file:///c:/schemas/myschema.xsd

note that xerces 1.1.3 has bugs handling directory/file names
with spaces. this is supposed to be resolved in the 1.1.4 release
coming up at the end of the month.

the other thing you will need to do is make sure you set
validation to true (see the feature and/or properties section of
the xerces documentation for code snippet).

hope this is useful. i'm still learning myself and if this is
useful i give all credit, honor, and glory to the members of this
list that have helped me out two weeks ago.

rjsjr

> -----Original Message-----
> From: Todd Kessler [mailto:TKessler@DoveBid.com]
> Sent: Tuesday, August 22, 2000 6:57 PM
> To: xerces-j-dev@xml.apache.org
> Subject: Using Schema with Xerces Parser
>
>
> I am looking for a Schema FAQ or code examples that detail how to validate
> XML against a Schema using the Xerces parser. I am attempting to use the
> Xerces Parser and validate with a XDR or Biztalk type schema.
>
> Tod Kessler
> www.DoveBid.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>