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

NullPointerException in handleStartElement

           Summary: NullPointerException in handleStartElement
           Product: Xerces2-J
           Version: 2.3.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Validating the following instance:
<?xml version="1.0" encoding="UTF-8"?>
<p1:test 
xmlns:p1="http://ns.example.com/example"; xmlns:p2="http://www.w3.org/2001/XMLSchema-
instance">
  <p1:firstName>Mary</p1:firstName>
  
<p1:lastName>Holstege</p1:lastName>
  <p1:email p2:type="p1:ExtendedEmailAddress" 
for="work">[EMAIL PROTECTED]</p1:email> 
</p1:test>

Against the following 
schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
targetNamespace="http://ns.example.com/example";
     
xmlns:p="http://ns.example.com/example";
     
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
     elementFormDefault="qualified" 
     
attributeFormDefault="unqualified"
     version="0.1"
>

  <xs:complexType 
name="AnyCommunicationAddress">
    <xs:simpleContent>
      <xs:extension 
base="xs:string">
        <xs:attributeGroup ref="p:AddressAttributes"/>
      
</xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  
  <xs:element 
name="anyAddress" type="p:AnyCommunicationAddress" abstract="true"/>
  
<xs:complexType name="ExtendedEmailAddress">
    <xs:complexContent>
      <xs:extension 
base="p:AnyCommunicationAddress">
        <xs:attribute name="isCurrent" type="xs:boolean" 
use="optional"/>
        <xs:attribute name="isPrimary" type="xs:boolean" use="optional"/>
      
</xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element 
name="email" type="p:ExtendedEmailAddress" substitutionGroup="p:anyAddress"/>

  
<xs:attributeGroup name="AddressAttributes">
    <xs:attribute name="for" 
type="p:AddressPurpose" use="required"/>
  </xs:attributeGroup>

  <xs:element 
name="test">
    <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName" 
type="xs:string" minOccurs="0"/>
      <xs:element name="lastName" type="xs:string" 
minOccurs="0"/>
      <xs:element ref="p:anyAddress" minOccurs="0" 
maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
  
</xs:element>

</xs:schema> 

Leads to the following exception:
<?xml version="1.0" 
encoding="UTF-8"?>
<xs:schema targetNamespace="http://ns.example.com/example";
     
xmlns:p="http://ns.example.com/example";
     
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
     elementFormDefault="qualified" 
     
attributeFormDefault="unqualified"
     version="0.1"
>

  <xs:complexType 
name="AnyCommunicationAddress">
    <xs:simpleContent>
      <xs:extension 
base="xs:string">
        <xs:attributeGroup ref="p:AddressAttributes"/>
      
</xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  
  <xs:element 
name="anyAddress" type="p:AnyCommunicationAddress" abstract="true"/>
  
<xs:complexType name="ExtendedEmailAddress">
    <xs:complexContent>
      <xs:extension 
base="p:AnyCommunicationAddress">
        <xs:attribute name="isCurrent" type="xs:boolean" 
use="optional"/>
        <xs:attribute name="isPrimary" type="xs:boolean" use="optional"/>
      
</xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element 
name="email" type="p:ExtendedEmailAddress" substitutionGroup="p:anyAddress"/>

  
<xs:attributeGroup name="AddressAttributes">
    <xs:attribute name="for" 
type="p:AddressPurpose" use="required"/>
  </xs:attributeGroup>

  <xs:element 
name="test">
    <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName" 
type="xs:string" minOccurs="0"/>
      <xs:element name="lastName" type="xs:string" 
minOccurs="0"/>
      <xs:element ref="p:anyAddress" minOccurs="0" 
maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
  
</xs:element>

</xs:schema> 

Changing the type at the root of the substitution group, 
AnyCommunicationAddress to be complexType mixed=true eliminates this problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to