[EMAIL PROTECTED] wrote:
> 
> I'm experiencing a problem with the Marshaller marshal(Object, Node)
> method. Nothing seems to be marshalling into the node.
> Ultimately, I'm trying to generate a nicely formatted XML file from my marshalled 
>objects using Xerces' XMLSerializer. Previously,
> I was using the marshal(Writer) method that generated the XML correctly though it 
>outputted to the file as one continuous unformatted string.

Castor also uses the Xerces Serializers, you can turn on formatting by
setting the indent property in the castor.properties file to true.

--Keith

> 
> Am I using the marshal(Object, Node) method incorrectly? Also, if Castor has a 
>better way of doing this please let me know...
> 
> Document doc = 
>DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
> // Set root element
> Node element = (Node) doc.createElement("UOWDataDescriptor");
> // Marshal to node
> org.exolab.castor.xml.Marshaller.marshal(uow, element);
> // Append element to document
> doc.appendChild(element);
> // Set format
> OutputFormat format = new OutputFormat("xml", "UTF-8", true );
> format.setLineSeparator(org.apache.xml.serialize.LineSeparator.Windows);
> format.setIndent(1);
> // Create Xerces serializer
> XMLSerializer toFile = new XMLSerializer(new FileWriter(file), format);
> // Serialize
> toFile.serialize(doc);
> 
> * Upon run-time, I get nothing marshalled into element from uow (my root Castor 
>object) and finally a NoSuchMethodError exception is thrown in the
>  serialize() b/c element isn't populated.
> 
> This transmission may contain information that is privileged, confidential and/or 
>exempt from disclosure under applicable law. If you are not the intended recipient, 
>you are hereby notified that any disclosure, copying, distribution, or use of the 
>information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. 
>If you received this transmission in error, please immediately contact the sender and 
>destroy the material in its entirety, whether in electronic or hard copy format. 
>Thank you.
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to