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

XML Schema 1.1: Assertion in simpleContent in complexType with restriction

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.9.1
    • 2.10.0
    • None

    Description

      Fail to apply base type's assertion.

      Example:

      <?xml version="1.1"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="root" type="rootType" />
      <xs:complexType name="rootType">
      <xs:simpleContent>
      <xs:restriction base="xs:anyType">
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:assertion test="invalid-XPath-expression()"/>
      </xs:restriction>
      </xs:simpleType>
      </xs:restriction>
      </xs:simpleContent>
      </xs:complexType>
      </xs:schema>

      <xs:assertion test="invalid-XPath-expression()"/> won't be tested.

      Reason:

      Missing "inherit assertion" code in

      • @version $Id: XSSimpleTypeDecl.java 904730 2010-01-30 06:40:11Z mukulg $

      Patch:

      add

      // inherit assertion. added for XML Schema 1.1
      if ((fFacetsDefined & FACET_ASSERT) == 0 && (fBase.fFacetsDefined & FACET_ASSERT) != 0) {
      fFacetsDefined |= FACET_ASSERT;

      if ((fixedFacet & FACET_ASSERT) != 0)

      { fFixedFacet |= FACET_ASSERT; }

      }

      to the end of step 4 in function

      void applyFacets(XSFacets facets, int presentFacet, int fixedFacet, short patternType, ValidationContext context)
      throws InvalidDatatypeFacetException

      Attachments

        1. patch.txt
          1 kB
          Kun Xu

        Activity

          People

            mukul_gandhi Mukul Gandhi
            kunxu Kun Xu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: