[
Lists Home |
Date Index |
Thread Index
]
Hello,
You need to turn on both -v and -s to use schema validation. This turns on the two features http://xml.org/sax/features/validation and
http://apache.org/xml/features/validation/schema which are required for schema validation.
Hope that helps!
Priscilla
------------------------------------------------------------------
Priscilla Walmsley priscilla@walmsley.com
Author, Definitive XML Schema (Prentice Hall PTR)
------------------------------------------------------------------
-----Original Message-----
From: Li Bing [SMTP:bing.li@asu.edu]
Sent: Thursday, April 18, 2002 7:00 AM
To: Ronald Bourret
Cc: XML-INTEREST@JAVA.SUN.COM; xml-dev@lists.xml.org
Subject: [xml-dev] Schema-Based Parser works that way? - dom.Counter Problems
Dear Mr. Ronald,
I just tried the code, dom.Counter
(http://xml.apache.org/xerces2-j/samples-dom.html#Counter). But some
problems puzzled me.
1) I wrote an XML file, note.xml, and its schema, note.xsd. Then I turned on
the option, -v. This option turns on validation. I got the following errors
[Error] note.xml:2:102: Document root element "note", must match DOCTYPE
root "null".
[Error] note.xml:2:102: Document is invalid: no grammar found.
note.xml: 213;27;0 ms (4 elems, 2 attrs, 0 spaces, 20 chars)
That's the same as DTD-based parser, right?
2) Then, I turned off -v and turned on -s, which meant Schema validation
support. However, even if one element exists in XML doesn't exist in its
schema, there is any error! DTD parser should get error under this
situation!
3) I tried another option -f, which meant schema full checking. The
situation in 2) also occurred. Why?
4) Errors can happen when XML is not well-formed!
Schema-based parser works that way? It is quite different from DTD-based
parser, right?
Thanks so much!
Li Bing
----- Original Message -----
From: "Ronald Bourret" <rpbourret@rpbourret.com>
To: "Li Bing" <bing.li@asu.edu>
Cc: <xml-dev@lists.xml.org>
Sent: Wednesday, April 17, 2002 11:03 PM
Subject: [xml-dev] Re: Why Can't I Find Java Codes About This? Re: [xml-dev]
How Can I KnowMy XML is Valid With XML Schema Without DTD?
> Oracle's XML parser:
> http://technet.oracle.com/tech/xml/xdk_java.html
>
> Xerces-J:
> http://xml.apache.org/xerces-j/index.html
>
> Sun MSV:
> http://www.sun.com/software/xml/developers/multischema/
>
> -- Ron
>
> Li Bing wrote:
> >
> > Dear Mr. Bourret,
> >
> > Thanks so much for your help! But it is very strange that I can't find
any
> > Java codes about parsing XML according to XML Schemas on the Web or
relevant
> > books. Could you please provide me with information about this?
> >
> > Best regards,
> > Li Bing
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>
The list archives are at http://lists.xml.org/archives/xml-dev/
To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>
|