Neville,

What type of node is your parentNode? I just ran a simple test using a Document object as the parent and everything appears to be working fine for me.

<code-snippet>
   Document document = docBuilder.newDocument();
   Marshaller.marshal(foo, document);

   Source source = new DOMSource(document);
   Result result = new StreamResult(new File("output.xml"));
   TransformerFactory txFactory = TransformerFactory.newInstance();
   Transformer transformer = txFactory.newTransformer();
   transformer.transform(source, result);
</code-snippet>

I ran my test on Castor 0.9.9 as that is what my environment is set up for. I didn't notice any fixes between 0.9.7 and 0.9.9 on the SAX2DOMHandler, but you might want to give it a try.

--Keith



Neville Brown wrote:
Hi

I'm having an issue with marshalling XML, using Castor 0.9.7

I am trying to unmarshal XML to create the contents of a SOAP message, with
the following code:

Marshaller.marshal(busObj, parentNode);

parentNode is an instance of org.apache.axis.message.SOAPBody (from Axis
1.2.1), and looks like this:

<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
</soapenv:Body>

After marshalling, I get something like this:

<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
  < xmlns="http://mydefaultnamespace"; >
    < xmlns="Success"/>
      < xmlns="PricedItineraries">
        < xmlns="AirItinerary">
           somedata
        </>
      </>
    </>
  </>
</soapenv:Body>

I.E. it has lost the element name of the top level marshalled element, and
transposed element names to default namespaces in its child elements!

If I marshall to StringWriter, as follows, it works fine:
StringWriter writer = new StringWriter();
Marshaller marS = new Marshaller(writer);
marS.marshal(busObj);

Then I get what I expect:
  < responseContent xmlns="http://mydefaultnamespace"; >
    < Success/>
    < PricedItineraries>
      < AirItinerary>
         somedata
      </AirItinerary>
    </PricedItineraries>
  </responseContent>

Thanks in advance,

Nev
DISCLAIMER: The information in this Internet E-mail or Fax is confidential
and is intended solely for the addressee. Access, copying or re-use of
information in it by anyone else is unauthorised. Any views or opinions
presented are solely those of the author and do not necessarily represent
those of Flybe or any of its affiliates. If you are not the intended
recipient please contact [EMAIL PROTECTED] Flybe is the trading name of Jersey European Airways (UK) Ltd, Jack Walker House, Exeter International Airport, Exeter, Devon EX5 2HL Company Registration No. 2769768

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------




-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to