I just played around, with this kind of XSD validation, but using somewhat
simple XSD and XML input documents. Below are mentioned my XSD and XML
input documents,

XSD document,

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
                    elementFormDefault="qualified">

    <xs:element name="X">
       <xs:complexType>
           <xs:sequence>
               <xs:element name="fileName" type="FileName"
maxOccurs="unbounded"/>
           </xs:sequence>
       </xs:complexType>
    </xs:element>

    <xs:complexType name="FileName">
       <xs:simpleContent>
          <xs:extension base="xs:string">
             <xs:attribute name="att1" type="xs:string"/>
             <xs:assert test="if (./text()[matches(., 'a[0-9]')]) then
@att1 else true()"/>
          </xs:extension>
       </xs:simpleContent>
    </xs:complexType>

</xs:schema>

XML input document (which is found as valid with above mentioned schema
document),

<?xml version="1.0"?>
<X>
  <fileName>a</fileName>
  <fileName>b</fileName>
  <!-- comment ... -->
  <fileName att1="az">a0</fileName>
  <!-- comment ... -->
  <fileName>c</fileName>
  <fileName att1="az">a5</fileName>
</X>

When I remove comments from above mentioned XML input document, I still see
the XML input document as valid.

The following XML input documents are found as invalid,

<?xml version="1.0"?>
<X>
  <fileName>a</fileName>
  <fileName>b</fileName>
  <!-- comment ... -->
  <fileName>a0</fileName>
  <!-- comment ... -->
  <fileName>c</fileName>
  <fileName att1="az">a5</fileName>
</X>

<?xml version="1.0"?>
<X>
  <fileName>a</fileName>
  <fileName>b</fileName>
  <!-- comment ... -->
  <fileName>a0</fileName>
  <!-- comment ... -->
  <fileName>c</fileName>
  <fileName>a5</fileName>
</X>

Therefore, fundamentally I don't see a bug with Xerces-J with the kind of
XSD and XML input documents discussed within this thread & the Jira issue
(those that are provided by John).



-- 
Regards,
Mukul Gandhi

Reply via email to