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/08/18 22:44:45 UTC

DO NOT REPLY [Bug 22531] New: - versus

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

<xsd:annotation/> versus <xsd:annotation></xsd:annotation>

           Summary: <xsd:annotation/> versus
                    <xsd:annotation></xsd:annotation>
           Product: Xerces2-J
           Version: 2.5.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: george@sync.ro


Validating an instance document against a schema gives different results 
depending whether the schema uses <xsd:annotation/> or 
<xsd:annotation></xsd:annotation>.

Here it is the sample XML:

<?xml version="1.0" encoding="UTF-8"?>
<test:test level="error" xmlns:test="http://www.example.com/test"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.example.com/test problem.xsd">
    <content>some content</content>
</test:test>

Here it is the problem.xsd schema with <xsd:annotation></xsd:annotation> - 
Xerces 2.5.0 validates the document without errors:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.example.com/test" 
xmlns:test="http://www.example.com/test" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!--
  -->
    <xsd:element name="test" type="test:testType"/>
    <!--
  -->
    <xsd:complexType name="testType">        
        <xsd:sequence>
            <xsd:element maxOccurs="2" minOccurs="1" name="content" 
type="xsd:string"/>
        </xsd:sequence>
        <xsd:attribute name="level" type="xsd:string">
            <xsd:annotation></xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>
</xsd:schema>

And here it is the same schema but the annotation element is written as 
<xsd:annotation/>. In this case I get the following error:
- [ test.xml] E cvc-complex-type.2.1: Element 'test:test' must have no 
character or element information item [children], because the type's content 
type is empty. (5:1)

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.example.com/test" 
xmlns:test="http://www.example.com/test" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!--
  -->
    <xsd:element name="test" type="test:testType"/>
    <!--
  -->
    <xsd:complexType name="testType">        
        <xsd:sequence>
            <xsd:element maxOccurs="2" minOccurs="1" name="content" 
type="xsd:string"/>
        </xsd:sequence>
        <xsd:attribute name="level" type="xsd:string">
            <xsd:annotation/>
        </xsd:attribute>
    </xsd:complexType>
</xsd:schema>

I marked this as critical because how the annotation is represented should not 
affect the document validation.

Thanks for looking into this.

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