users@jaxb.java.net

JAXB conversion of wildcard to DOM (<xjc:dom />) stripping out na mespace attributes

From: Geis, Matt <Matt.Geis_at_schwab.com>
Date: Wed, 23 Jul 2003 14:27:31 -0700

Can anyone help out with this problem? I'm unmarshalling a document with an
xsd:any block, and getting the contents as a DOM element. Unfortunately,
when JAXB generates the DOM, it removes some of the namespace attributes,
and moves others to different elements.



Here's how the element is defined in the xsd.



<complexType name="wsdl">

      <sequence>

        <any processContents="skip" maxOccurs="unbounded">

               <annotation><appinfo>

              <xjc:dom />

               </appinfo></annotation>

            </any>

      </sequence>

    </complexType>



Here's how the the corresponding section of the file looks (just the
wildcard and a bit of what follows)

<WSDL>

   <definitions name="MobilePhoneService"

      targetNamespace="http://www.mobilephoneservice.com/MobilePhoneService"

      xmlns="http://schemas.xmlsoap.org/wsdl/"

      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

      xmlns:tns="http://www.mobilephoneservice.com/MobilePhoneService"

      xmlns:xsd="http://www.w3.org/1999/XMLSchema">

      <types>....



Here's the corresponding contents of the DOM after parsing, output as a
String

<definitions name="MobilePhoneService"
targetNamespace="http://www.mobilephoneservice.com/MobilePhoneService">

   <types>...



Note the absence of all the xmlns attributes. I explicitly called
setNamespaceAware(true) on the factories at the beginning of my application,
if that has any bearing on the issue.



The rest of the contents contain values which use the namespace
abbreviations (like an element definition of type tns:Vector), but with no
attribute associating "tns" with a real URI, I end up with errors when I try
to pass this incomplete DOM on to a method that expects a correct DOM (one
where namespace references actually point somewhere).



Why is JAXB stripping out these attributes? Am I doing something wrong, or
is this a bug? When I try to parse a file with the correct contents into a
DOM, the dom shows ALL attributes as present, and I get no errors. It's
only when I use JAXB to return a DOM from a wildcard element that I have
problems.



Thanks,
Matt