You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/03/27 11:46:57 UTC

DO NOT REPLY [Bug 18405] New: - Comination of fields in acts as

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18405>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18405

Comination of fields in <xsd:unique> acts as <xsd:key>

           Summary: Comination of fields in <xsd:unique> acts as <xsd:key>
           Product: Xerces2-J
           Version: 2.3.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: ismael.cams@siemens.com


Overview Description:
When defining a combination of fields that should be unique by means of the 
<xsd:unique> element the defined fields are optional and don't need to be 
available in the instance document. However when defining more than one field 
under the <xsd:unique> element, Xerces generates an error message when one of 
the fields is not present: "Not enough values specified for <unique> identity 
constraint specified for element"

Steps to Reproduce:
schema.xsd
-----------
<?xml version="1.0"?>

<xsd:schema xmlns:ipm="http://unique/test"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			targetNamespace="http://unique/test"
			elementFormDefault="qualified">
			
<xsd:element name="root">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element ref="ipm:node" minOccurs="0" 
maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:unique name="uniqueNode">
		<xsd:selector xpath="ipm:node"/>
		<xsd:field xpath="@name"/>
		<xsd:field xpath="ipm:module/@name"/>
	</xsd:unique>
</xsd:element>

<xsd:element name="node">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element name="module" minOccurs="0" maxOccurs="1">
				<xsd:complexType>
					<xsd:attribute name="name" 
type="xsd:string"/>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string"/>
	</xsd:complexType>
</xsd:element>

</xsd:schema>

instance document
-----------------
<?xml version="1.0"?>

<root xmlns="http://unique/test" 
	  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	  xsi:schemaLocation="http://unique/test unique.xsd">
	  
<node>
	<module name="test2"/>
</node>

<node name="router">
	<module name="test1"/>
</node>

</root>

Validation is done with the sax.Counter class available in xercesSamples.jar.
Usage: "java -classpath xercesSamples.jar;xercesImpl.jar;xmlParserAPIs.jar 
sax.Counter -s -v unique.xml"

Actual Results:
Gives following output
[Error] unique.xml:9:8: Not enough values specified for <unique> identity 
constraint specified for element "root".

Expected Results:
Should be valid

Build Date & Platform:
First encountered with XercesJ-2.0.0
Replaced the jar files with those of XercesJ-2.3.0 but still encountered the 
same problem

Additional Information:
The problem only occurs when defining a combination of fields. When only one 
field there seems be no problem.

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