Hi Inga,

     If I try your example using sax.SAXCount with validation turned on, I
see the following error.

   $ java sax.SAXCount -v facet1-doc.xml
   [Error] facet1-doc.xml:4:27: Datatype error: In element 'UserName' : 25
   is out of bounds:[ 100 <= X  <= 1000 ]..
   facet1-doc.xml: 4617 ms (2 elems, 2 attrs, 4 spaces, 2 chars)


     It could be that you didn't register an error handler using the
setErrorHandler() method on the parser.

Thanks,

Henry
------------------------------------------------------------------------
Henry Zongaro      XML Parsers development
IBM SWS Toronto Lab   Tie Line 778-6044;  Phone (416) 448-6044
mailto:[EMAIL PROTECTED]


"Inga Schuetz" <[EMAIL PROTECTED]> on 03/28/2001 05:20:15 AM

Please respond to [EMAIL PROTECTED]

To:   "Xerces-J-User" <[EMAIL PROTECTED]>
cc:
Subject:  Problems with constrainig facets


Hallo!

I think the following XML-Code should cause an error during validated
parsing. The value of UserName is below the minInclusive Value of the
schema. I don't get any error message.

The features of the parser are set like this

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

The XML-file

<?xml version="1.0" encoding="UTF-8"?>
<Person xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="D:\USERS\schuetz\XML\facet1.xsd">
           <UserName>25</UserName>
</Person>

The XML-Schema

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema";
elementFormDefault="qualified">
           <xsd:element name="Person" >
                     <xsd:complexType>
                               <xsd:sequence>
                                          <xsd:element name="UserName" type
="userName"/>
                               </xsd:sequence>
                     </xsd:complexType>
           </xsd:element>
           <xsd:simpleType name="userName">
                     <xsd:restriction base="xsd:integer">
                               <xsd:minInclusive value="100"/>
                               <xsd:maxInclusive value="1000"/>
                     </xsd:restriction>
           </xsd:simpleType>
</xsd:schema>

Thanks, for your help
Inga


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to