xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel.COLL...@tcc.thomson-csf.com
Subject RE: Schema validation with Xerces-J 1.2.1
Date Mon, 04 Dec 2000 15:51:58 GMT
Hi Neil Graham,

I just whant to deal with schema validation by I don't know how !
With the following code (Validator.java) DTD validation works but schema
validation doesn't.

Regards.
		Emmanuel.

-----Message d'origine-----
De: neilg@ca.ibm.com [mailto:neilg@ca.ibm.com]
Date: lundi 4 décembre 2000 16:41
À: xerces-j-dev@xml.apache.org
Objet: RE: Schema validation with Xerces-J 1.2.1






Hi Emmanuel,

I got an error when I tried to validate your example using the most recent
CVS version of Xercies 1.2.2.  The error went away when I defined element
Foobar and made the appropriate modifications to the declaration of Foo.
So it seems that the DTD and the schema version of your example do perform
equivalently.

How did you go about trying to validate this example?

Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  416-448-3519, T/L 778-3519
E-mail:  neilg@ca.ibm.com



Emmanuel.COLLAIN@tcc.thomson-csf.com on 12/01/2000 03:33:32 AM

Please respond to xerces-j-dev@xml.apache.org

To:   xerces-j-dev@xml.apache.org
cc:
Subject:  RE: Schema validation with Xerces-J 1.2.1




Hi,

To complete my question I give my code in Xerces-J for xml validation.
What's wrong or missing in it ?

Thanks for your help.

     Emmanuel.

-----Message d'origine-----
De: Emmanuel.COLLAIN@tcc.thomson-csf.com
[mailto:Emmanuel.COLLAIN@tcc.thomson-csf.com]
Date: mercredi 29 novembre 2000 12:51
À: xerces-j-dev@xml.apache.org
Objet: Schema validation with Xerces-J 1.2.1


Hi all,
I use Xerces-J 1.2.1. I want to validate a document instance with a
XML-schema, but it doesn't wotks. (The DTD validation works.)

For example, with the document :
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE Foo SYSTEM "Foo.dtd">
<Foo>
   <Bar>some text</Bar>
   <Foobar/>
   <Bar>some text again</Bar>
</Foo>

and his DTD :

<?xml version="1.0" encoding="ISO-8859-1"?>
<!ELEMENT Foo (Bar*)>
<!ELEMENT Bar (#PCDATA)>

an error is detected because the element "Foobar" is unknown. And, with the
document instance :

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<Foo xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Foo.xsd">
   <Bar>some text</Bar>
   <Foobar/>
   <Bar>some text again</Bar>
</Foo>

and his schema :

<?xml version="1.0" encoding="ISO-8859-1">
<schema>
   <element name="Foo">
      <complexType content="elementOnly">
     <element ref="Bar" minOccurs="0" maxOccurs="unbounded"/>
      </complexType>
   </element>
  <element name="Bar" type="string"/>
</schema>

no error detected !!!

In the both cases I set the following features :
         parser.setFeature("http://xml.org/sax/features/validation",
true);

parser.setFeature("http://apache.org/xml/features/validation/dynamic",
true);

parser.setFeature("http://apache.org/xml/features/validation/schema",
true);
and I use a DOM parser.

May I miss something ? Do I something wrong ?
Thanks for your help.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Mime
View raw message