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=17076>.
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=17076

Does implement co-occurence constraints

           Summary: Does implement co-occurence constraints
           Product: Xerces-C++
           Version: 2.2.0
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validating Parser (Schema) (Xerces 1.5 or up only)
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Sun Workshop 6 Update 2 C++ 5.3

The Xerces libray does not perform co-occurence checks.
 test.xml
<?xml version="1.0" encoding="UTF-8" ?>
<sm:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="SP test.xsd"
xmlns:sm="SP">

  <sm:a aID="1" x="1" y="1"/>

</sm:root>

test.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
           targetNamespace="SP"
           xmlns:sm="SP"
           attributeFormDefault="unqualified" elementFormDefault="qualified">
  

  <xsd:complexType name="CTa">
    <xsd:attribute name="aID" type="xsd:integer" use="required" />
    <xsd:attribute name="x" type="xsd:integer" use="optional" />
    <xsd:attribute name="y" type="xsd:integer" use="optional" />
    <xsd:attribute name="z" type="xsd:integer" use="optional" />
  </xsd:complexType>


  <!-- DEFINITION OF THE ONLY ALLOWED ROOT ELEMENT -->
  <xsd:element name="root">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="a" type="sm:CTa" maxOccurs="unbounded">
          <xsd:key name="xORzKEY">
            <xsd:selector xpath="."/>
            <xsd:field    xpath="@x|@y"/>
            <!--<xsd:field    xpath="@x|@z"/>-->
          </xsd:key>
       </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

The Xerces library should report an error to the effect that "the field XPath 
expression '@x|@y' evaluated to more than one node for identity-constraint '{SP}
xORzKEY'. Line:6 col: 30. <sm:a aID="1" x="1" y="1"/>

MSXML4 complies. vb script
Option Explicit

dim x
set x = CreateObject("MSXML2.DOMDocument.4.0")
x.async = false
x.validateOnParse = true
x.load("test.xml")
if x.parseError.errorCode <> 0 then
  WScript.Echo("errorReason=" + x.parseError.reason & "Line:" & 
x.parseError.line & ", pos " & x.parseError.linepos &   vbcrlf & 
x.parseError.srcText)
else 
  WScript.Echo("===NO PARSE ERROR===")
end if

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

Reply via email to