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 2002/09/16 10:46:51 UTC

DO NOT REPLY [Bug 12675] New: - ID-attributes in XML Schema not passed on as such

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

ID-attributes in XML Schema not passed on as such

           Summary: ID-attributes in XML Schema not passed on as such
           Product: Xerces2-J
           Version: 2.1.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: SAX
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: sander@x-hive.com


In Xerces 2.0.1, if you parsed an XML file with an XML Schema attached, with 
the parser options "http://xml.org/sax/features/validation" 
and "http://apache.org/xml/features/validation/schema" set to true, attributes 
registered as ID attributes in the XML schema (e.g. <xs:attribute name="id"  
type="xs:ID" use='required'/>) would give back 'ID' for attrs.getType(i); in 
startElement. In Xerces 2.1.0, it gives back "CDATA" for all attributes.

Sample code:
  for (int i = 0; i < attrs.getLength(); i++) {
    String attrName = attrs.getQName(i);
    String attrValue = attrs.getValue(i);
    String attrType = attrs.getType(i);
    System.out.println("attrName: " + attrName + ", attrValue: " + attrValue 
+ ", attrType: " + attrType);
  }
in startElement gives back 
  attrName: id, attrValue: Big.Boss, attrType: ID
for Xerces 2.0.1 and 
  attrName: id, attrValue: Big.Boss, attrType: CDATA
for Xerces 2.1.0, for the file:
  <?xml version="1.0" encoding="UTF-8"?>
  <personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  	   xsi:noNamespaceSchemaLocation='personal.xsd'>
    <person id="Big.Boss"/>
  </personnel>
with schema:
  <?xml version="1.0" encoding="UTF-8"?>
  <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
   <xs:element name="personnel">
    <xs:complexType>
     <xs:sequence>
       <xs:element ref="person" minOccurs='1' maxOccurs='unbounded'/>
     </xs:sequence>
    </xs:complexType>
   </xs:element>
   <xs:element name="person">
    <xs:complexType>
     <xs:attribute name="id"  type="xs:ID" use='required'/>
    </xs:complexType>
   </xs:element>
  </xs:schema>

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