Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: Schema-Structures (show other bugs)
Version: unspecified
Hardware: All All
: P1 critical
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords: Xerces2
Depends on:
Blocks:
 
Reported: 2005-03-18 01:50 UTC by 12345
Modified: 2005-03-17 16:50 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 12345 2005-03-18 01:50:21 UTC
Hi,

I have a question about XML Validation feature of Xerces-Java2.6.2

Currently, I am trying to validate schema with two local elements enclosed into 
different groups. The reason why I have two local elements with same name is 
because I am trying to map a protocol so that element names and values in 
protocol have to match the schema. Also, both elements have same attributes, 
they both have different enumerations. So when REF apprears first time, it can 
only have two values F1 and F2. Wjen REF appears second time it can only have 
A1 and A2.

The schema validates just fine with XMLSPY 2004 however it failes to validate 
in XMLSPY2005 and in Intelij as well.

Here is my schema and xml examples:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="ROOT">
		<xs:annotation>
			<xs:documentation>Comment describing your root 
element</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:group ref="REF1" minOccurs="0"/>
				<xs:group ref="REF2" minOccurs="0"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:group name="REF1">
		<xs:sequence>
			<xs:element name="REF">
				<xs:annotation>
					<xs:documentation>REFERENCE 
IDENTIFIER</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name="REF1" 
use="required">
						<xs:simpleType>
							<xs:restriction 
base="xs:string">
								<xs:enumeration 
value="F1"/>
								<xs:enumeration 
value="F2"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
					<xs:attribute name="REF2" 
type="xs:string" use="required"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:group>
	<xs:group name="REF2">
		<xs:sequence>
			<xs:element name="REF">
				<xs:annotation>
					<xs:documentation>REFERENCE 
QUALIFIER</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name="REF1" 
use="required">
						<xs:simpleType>
							<xs:restriction 
base="xs:string">
								<xs:enumeration 
value="A1"/>
								<xs:enumeration 
value="A2"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
					<xs:attribute name="REF2" 
type="xs:string" use="required"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:group>
</xs:schema>

<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XML Spy v4.0 U (http://www.xmlspy.com)-->
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="C:\Documents and 
Settings\MVeksler\Desktop\SAMPLE1.xsd">
	<REF REF1="F1" REF2="String"/>
	<REF REF1="A1" REF2="String"/>
</ROOT>