Hi,
I'm using Castor 1.0.5 and trying to marshal into a DOM Node object. I
think I'm missing something.
The JavaDoc says this about this constructor:
public Marshaller(org.w3c.dom.Node node)
Creates a new Marshaller for the given DOM Node.
Parameters:
node - the DOM node to marshal into.
I thought this means that if I provide a Node to this constructor, and
then later invoke marshal(), the marshalling will populate the Node
instance with a DOM tree. Is this the right interpretation?
Here's how I'm invoking the Marshaller:
===============================
Document doc = new DocumentImpl(); //
org.apache.xerces.dom.DocumentImpl
Node root = doc.createElement("root");
Mapping mapping = new Mapping();
... configure mapping ...
Marshaller ma = new Marshaller(root);
ma.setMapping(mapping);
ma.marshal(o);
// another marshaller to String to see what I should get
StringWriter output = new StringWriter();
Marshaller ma2 = new Marshaller(output);
ma2.setMapping(mapping);
Ma2.marshal(o);
doc.appendChild(root);
===============================
root.toString() -
[root: null]
doc.toString() -
[#document: null]
output.toString() -
<?xml version="1.0" encoding="UTF-8"?>
<all/> <kinds of/> <XML goodness,/> <just like I wanted/>
What am I missing? Is this not the intent of the Marshaller constructor
w/ Node parameter? Am I missing a step? Are there constraints on the
Node that I pass that I'm missing?
Thanks for any illumination that can be provided,
-ace
_____________
Ace Thompson
MUOS GS Modeling & Simulation
DataSoft Corp partner w/ General Dynamics C4 Systems
[EMAIL PROTECTED]
+1 480 441 4245
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email