Octavian Nadolu created XERCESJ-1596:
----------------------------------------

             Summary: Open content validation problem
                 Key: XERCESJ-1596
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1596
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.1 Structures
    Affects Versions: 2.11.0
            Reporter: Octavian Nadolu
            Priority: Minor


If I validate the following XML file with the XML Schema I get an error: 
"cos-element-consistent.4: A wildcard matched a global element 'r:Title'  ...."
The problem is that in the "<r:Book>" element we have as last child the 
"<r:Title>" element. There should be no error because the "Book" element has an 
open content which specifies that elements from target namespace are permitted 
as last children.


------ XML Instance -------------------------
<r:BookStore xmlns:r="http://www.books.org"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
  xsi:schemaLocation="http://www.books.org schema.xsd">
    <r:Book>
        <r:Title>Title0</r:Title>
        <r:Author>Author0</r:Author>
        <r:Date>2006</r:Date>
        <r:ISBN>ISBN0</r:ISBN>
        <r:Publisher>Publisher0</r:Publisher>
        <r:Title>Title1</r:Title>
    </r:Book>
</r:BookStore>
-----------------------------------------

----- XML Schema -------------------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
targetNamespace="http://www.books.org";
    xmlns:r="http://www.books.org"; elementFormDefault="qualified">
    <xs:element name="BookStore">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Book" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:openContent mode="suffix">
                            <xs:any processContents="lax" 
namespace="##targetNamespace"/>
                        </xs:openContent>
                        <xs:sequence>
                            <xs:element name="Title" type="xs:string"/>
                            <xs:element name="Author" type="xs:string"/>
                            <xs:element name="Date" type="xs:gYear"/>
                            <xs:element name="ISBN" type="xs:string"/>
                            <xs:element name="Publisher" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
------------------------------------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to