users@jaxb.java.net

Getting error w/ namespace

From: Chris O'Connell <oconnell_at_gorillachicago.com>
Date: Tue, 24 Mar 2009 18:40:52 -0500

 I am getting an xml feed that contains a schema inside of it. To be
honest, I am stumped. If someone can point me at something that will help
me figure this out, I would appreciate it. I guess I just haven't quite
gotten my head around how to handle the namespace. I have generated some
bindings, but when trying to unmarshall, I get an error that says:
javax.xml.bind.UnmarshalException: unexpected element (uri:"
http://tempuri.org/", local:"DataSet"). Expected elements are <{}DataSet>

A sample of the xml feed that I am getting is below. I also am including
the schema that I was able to put together to try to generate my bindings.
If someone can make some sense of this, I would really appreciate it.

Thanks,
Chris

Schema
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
          xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb"
          attributeFormDefault="unqualified" jaxb:version="2.0" >
    <xs:element name="DataSet" type="DataSet" />

    <xs:complexType name="DataSet">
        <xs:annotation>
            <xs:documentation>A person and their contact
information</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="diffgram" type="diffgram" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="diffgram">
        <xs:annotation>
            <xs:documentation>A person and their contact
information</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="NewDataSet" type="NewDataSet" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

        <xs:complexType name="NewDataSet">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="Table1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="COMPANY_NAME" type="xs:string"
minOccurs="0"/>
                            <xs:element name="ADDRESS1" type="xs:string"
minOccurs="0"/>
                            <xs:element name="ADDRESS2" type="xs:string"
minOccurs="0"/>
                            <xs:element name="ADDRESS3" type="xs:string"
minOccurs="0"/>
                            <xs:element name="TOWN" type="xs:string"
minOccurs="0"/>
                            <xs:element name="COUNTY" type="xs:string"
minOccurs="0"/>
                            <xs:element name="POSTCODE" type="xs:string"
minOccurs="0"/>
                            <xs:element name="COMURN" type="xs:decimal"
minOccurs="0"/>
                            <xs:element name="DISTANCE" type="xs:double"
minOccurs="0"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:complexType>
</xs:schema>

Data Feed
<?xml version="1.0" encoding="utf-8"?>
<DataSet xmlns="http://tempuri.org/">
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table1">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="COMPANY_NAME" type="xs:string"
minOccurs="0" />
                <xs:element name="ADDRESS1" type="xs:string" minOccurs="0"
/>
                <xs:element name="ADDRESS2" type="xs:string" minOccurs="0"
/>
                <xs:element name="ADDRESS3" type="xs:string" minOccurs="0"
/>
                <xs:element name="TOWN" type="xs:string" minOccurs="0" />
                <xs:element name="COUNTY" type="xs:string" minOccurs="0" />
                <xs:element name="POSTCODE" type="xs:string" minOccurs="0"
/>
                <xs:element name="COMURN" type="xs:decimal" minOccurs="0" />
                <xs:element name="DISTANCE" type="xs:double" minOccurs="0"
/>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
    <NewDataSet xmlns="">
      <Table1 diffgr:id="Table11" msdata:rowOrder="0">
        <COMPANY_NAME>Secure Omega Logistics</COMPANY_NAME>
        <ADDRESS1>Unit 3-6</ADDRESS1>
        <ADDRESS2>Wirral Business Park</ADDRESS2>
        <ADDRESS3>Upton</ADDRESS3>
        <TOWN>WIRRAL</TOWN>
        <POSTCODE>CH49 1QZ</POSTCODE>
        <COMURN>17845</COMURN>
        <DISTANCE>0.062138818119679362</DISTANCE>
      </Table1>
      <Table1 diffgr:id="Table12" msdata:rowOrder="1">
        <COMPANY_NAME>Direct Marketing Support Ltd</COMPANY_NAME>
        <ADDRESS1>Unit 1a-1f</ADDRESS1>
        <ADDRESS2>Wirral Business Park</ADDRESS2>
        <ADDRESS3>Upton</ADDRESS3>
        <TOWN>WIRRAL</TOWN>
        <COUNTY />
        <POSTCODE>CH49 1QZ</POSTCODE>
        <COMURN>1</COMURN>
        <DISTANCE>0.062138818119679362</DISTANCE>
      </Table1>
      <Table1 diffgr:id="Table13" msdata:rowOrder="2">
        <COMPANY_NAME>L Test</COMPANY_NAME>
        <ADDRESS1>5</ADDRESS1>
        <ADDRESS2>Gordon Road</ADDRESS2>
        <TOWN>WALLASEY</TOWN>
        <POSTCODE>CH49 1QZ</POSTCODE>
        <COMURN>92514</COMURN>
        <DISTANCE>0.062138818119679362</DISTANCE>
      </Table1>
      <Table1 diffgr:id="Table14" msdata:rowOrder="3">
        <COMPANY_NAME>D Cowderoy</COMPANY_NAME>
        <ADDRESS1>148 Brookdale Avenue South</ADDRESS1>
        <TOWN>WIRRAL</TOWN>
        <COUNTY>Cheshire</COUNTY>
        <POSTCODE>CH49 1SS</POSTCODE>
        <COMURN>67670</COMURN>
        <DISTANCE>0.13894662135709873</DISTANCE>
      </Table1>
      <Table1 diffgr:id="Table15" msdata:rowOrder="4">
        <COMPANY_NAME>A J Carruthers</COMPANY_NAME>
        <ADDRESS1>11 Caulfield Drive</ADDRESS1>
        <ADDRESS2>Greasby</ADDRESS2>
        <TOWN>WIRRAL</TOWN>
        <COUNTY>Cheshire</COUNTY>
        <POSTCODE>CH49 1SN</POSTCODE>
        <COMURN>66199</COMURN>
        <DISTANCE>0.2562049105584826</DISTANCE>
      </Table1>
      <Table1 diffgr:id="Table16" msdata:rowOrder="5">
        <COMPANY_NAME>Homebase</COMPANY_NAME>
        <ADDRESS1>Upton By Pass</ADDRESS1>
        <TOWN>WIRRAL</TOWN>
        <POSTCODE>CH49 6QG</POSTCODE>
        <COMURN>14579</COMURN>
        <DISTANCE>0.31684704614383796</DISTANCE>
      </Table1>
      <Table1 diffgr:id="Table17" msdata:rowOrder="6">
        <COMPANY_NAME>Wirral Hospital N H S Trust</COMPANY_NAME>
        <ADDRESS1>Arrowe Park Hospital</ADDRESS1>
        <ADDRESS2>Arrowe Park Road</ADDRESS2>
        <TOWN>WIRRAL</TOWN>
        <COUNTY>Cheshire</COUNTY>
        <POSTCODE>CH49 5PE</POSTCODE>
        <COMURN>83828</COMURN>
        <DISTANCE>0.48531968408044829</DISTANCE>
      </Table1>
    </NewDataSet>
  </diffgr:diffgram>
</DataSet>