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 Randy Cox <ra...@countrycompanies.com> on 2000/10/05 16:39:00 UTC

Problem parsing from a string.

I have the following xml and dtd.  If if call the paser passing in a uri to the xml file I can parse the file with no problem.  If I try to parse the xml message from a string using an InputSource I get a null pointer exception on parse.

I do not have control of the creation of the xml or the dtd.  I am using Xerces 1.2.0.

Thanks in advance for any help.

Randy Cox
CCSI
randy.cox@countrycompanies.com 

xml document:

<!DOCTYPE Message [
  <!ELEMENT Message (ListOfSmallContact)>
  <!ATTLIST Message
  MessageId CDATA #REQUIRED
    MessageType CDATA #REQUIRED
    IntObjectName CDATA #REQUIRED
>
  <!ENTITY % msg-body-entity SYSTEM "ListOfSmallContact.dtd">
  %msg-body-entity;
]>
<Message MessageId="" MessageType="Integration Object" IntObjectName="Jason Small Contact">
  <ListOfSmallContact>
    <Contact>
      <BirthDate>09/11/1887 00:00:00</BirthDate>
      <FirstName>Bickers</FirstName>
      <LastName>Davenport</LastName>
      <MM>Mr.</MM>
      <MiddleName>B</MiddleName>
      <PrimaryCity>Bloomington</PrimaryCity>
      <PrimaryPostalCode>61762</PrimaryPostalCode>
      <PrimaryState>IL</PrimaryState>
      <PrimaryStreetAddress>1711 GE Road</PrimaryStreetAddress>
      <ListOfContact_Position>
        <Contact_Position>
          <EmployeeFirstName></EmployeeFirstName>
          <EmployeeLastName>Administrator</EmployeeLastName>
          <Position> Administrator</Position>
        </Contact_Position>
      </ListOfContact_Position>
    </Contact>
  </ListOfSmallContact>
</Message>

dtd

<!ELEMENT ListOfSmallContact (Contact+)>
<!ELEMENT Contact (BirthDate?, FirstName?, LastName?, MM?, MiddleName?, PrimaryCity?, PrimaryPostalCode?, PrimaryState?, PrimaryStreetAddress?, ListOfContact_Position?)>
<!ELEMENT BirthDate (#PCDATA)>
<!ELEMENT FirstName (#PCDATA)>
<!ELEMENT LastName (#PCDATA)>
<!ELEMENT MM (#PCDATA)>
<!ELEMENT MiddleName (#PCDATA)>
<!ELEMENT PrimaryCity (#PCDATA)>
<!ELEMENT PrimaryPostalCode (#PCDATA)>
<!ELEMENT PrimaryState (#PCDATA)>
<!ELEMENT PrimaryStreetAddress (#PCDATA)>
<!ELEMENT ListOfContact_Position (Contact_Position*)>
<!ELEMENT Contact_Position (EmployeeFirstName?, EmployeeLastName?, Position?)>
<!ELEMENT EmployeeFirstName (#PCDATA)>
<!ELEMENT EmployeeLastName (#PCDATA)>
<!ELEMENT Position (#PCDATA)>