Hi all,

i am just a beginner with XMLBeans and i run into problem with a
NullPointerException. 
I got a schema from a company and a test XML File. 

The main part of the Schema (i will post here just a part of the
schema):
------------------------------------------------------------------------
----
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:abcstat="http://www.pagex.de/abc/spa";
xmlns:abcueb="http://www.pagex.de/abc/um";
xmlns:abcvend="http://www.pagex.de/abc/ve";
xmlns="http://www.pagex.de/zf/update";
targetNamespace="http://www.pagex.de/zf/update";
elementFormDefault="qualified" attributeFormDefault="qualified">
  <xs:include schemaLocation="something4.xsd"/>
  <xs:import namespace="http://www.pagex.de/abc/spa";
schemaLocation="abc/something1.xsd"/>
  <xs:import namespace="http://www.pagex.de/abc/um";
schemaLocation="abc/something2.xsd"/>
  <xs:import namespace="http://www.pagex.de/abc/ve";
schemaLocation="abc/something3.xsd"/>
  <xs:element name="FTmitt">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Mitt" type="mitt" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="mitt">
    <xs:choice>
      <xs:element ref="abcstat:Message"/>
      <xs:element ref="abcueb:Message"/>
      <xs:element ref="abcvend:Message"/>
    </xs:choice>
  </xs:complexType>
</xs:schema>
------------------------------------------------------------------------
----

The test.xml to parse:
------------------------------------------------------------------------
----
<?xml version="1.0" encoding="utf-8"?>
<FTmitt xmlns="http://www.pagex.de/zf/update";
xmlns:abc="http://www.pagex.de/abc/mitt";
xmlns:n1="http://www.pagex.de/zf/update";
xmlns:abcueb="http://www.pagex.de/abc/um";
xmlns:abcvend="http://www.pagex.de/abc/ve";
xmlns:abcstat="http://www.pagex.de/abc/spa";
xmlns:abcquit="http://www.pagex.de/abc/quittung";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >
  <Mitt n1:Satznummer="004">
    <abcstat:Message>
                <abc:Head>...</abc:Head>
                ...
                ...
                ...
          </abcstat:Message>
  </Mitt>
</FTmitt>
------------------------------------------------------------------------
----

Here some test code:
FTmittDocument doc = FTmittDocument.Factory.parse(new
File("./test.xml")); Mitt choices = doc.getMitt(); mitt[] m =
choices.getmittArray();

This Line print me the <xml-fragment>...</xml-fragment>
System.out.print(m[0].getMessage().xmlText()); 

But this line brings me a java.lang.NullPointerException!!!
m[0].getMessage().getHead();

All other get-Methods who belongs to the Message-Oject bring me
NullPointerException too.

Have somebody a idea or a hint?

Regards,
Andreas


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

Reply via email to