|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] trying to do XML Schema validation with Xerces-J 2.4.0, does not complai
I can get it to complain about structural error's. i.e. have a child element
in the instance document but not defined in the XML Schema.
But when I try to create in in-valid key constraint, i.e.
DataSet/WellEntireData/WellEntire/wellid is not unique, it does not throw an
exception. ( Note: xmlspy does )
Instance document:
<?xml version="1.0"?>
<DataSet xmlns=http://www.lgc.com/schema/OpenWorksData/2003
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.lgc.com/schema/OpenWorksData/2003
Adt_OW_Stratigraphy2_Schema.xsd">
<WellEntireData>
<WellEntire>
<wellid>3567</wellid>
</WellEntire>
<WellEntire>
<wellid>3197</wellid>
</WellEntire>
<WellEntire>
<wellid>3198</wellid>
</WellEntire>
<WellEntire>
<wellid>3567</wellid>
</WellEntire>
</WellEntireData>
</DataSet>
XML Schema file.
<?xml version="1.0"?>
<xs:schema targetNamespace="http://www.lgc.com/schema/OpenWorksData/2003"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.lgc.com/schema/OpenWorksData/2003"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<!--This XML Schema defines an ADT XML File. It Defines the DataModel
OpenWorksData and partitionName Stratigraphy2-->
<xs:element name="DataSet">
<xs:complexType>
<xs:all>
<xs:element name="WellEntireData" type="WellEntireData_Type"
minOccurs="0">
<xs:key name="WellEntire_InHierarchy_Key_Definition">
<xs:selector xpath="WellEntire"/>
<xs:field xpath="wellid"/>
</xs:key>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="WellEntireData_Type">
<xs:sequence>
<xs:group ref="WellEntire_Top_Group" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:group name="WellEntire_Top_Group">
<xs:choice>
<xs:element name="WellEntire" type="WellEntire_Type"/>
</xs:choice>
</xs:group>
<xs:complexType name="WellEntire_Type">
<xs:sequence>
<xs:group ref="WellEntire_Atrributes_Group"/>
</xs:sequence>
</xs:complexType>
<xs:group name="WellEntire_Atrributes_Group">
<xs:sequence>
<xs:element name="wellid" type="xs:integer"/>
</xs:sequence>
</xs:group>
<xs:complexType name="WellEntireRef_Type">
<xs:sequence>
<xs:element name="wellid" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
I have set the following features:
parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/
dynamic", true );
parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/
schema", true );
parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/
schema-full-checking", true );
parser.getXMLReader().setFeature("http://xml.org/sax/features/validation",
true );
Am I setting the features incorrectly ?
Does the 2.4.0 version of Xerces support this feature of XML Schema ?
Bill Riegel
LandMark Graphics
713-839-3388
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








