Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1596

Open content validation problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.11.0
    • None
    • None

    Description

      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>
      ------------------------------------------

      Attachments

        Activity

          People

            Unassigned Unassigned
            octavian.nadolu Octavian Nadolu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: