[
Lists Home |
Date Index |
Thread Index
]
> > That last bit - manipulate the data and then write a
> modified version of
> > it is something I don't see an analog for in XML.
>
> node.appendChildNode("foo")
> doc.toXML()
Or you can map class objects to XML structures using introspection:
/**
* Helper method for marshalling objects to XML.
*
* @param obj Object to marshal.
*/
private static void marshallBean( Object obj )
{
if (obj == null ) throw new RuntimeException( "obj is null" );
OutputStream os = System.out;
PrintWriter writer = new PrintWriter( os );
try
{
Marshaller.marshal(obj, writer);
}
catch (MarshalException e)
{
System.out.println( e.toString() );
}
catch (ValidationException e)
{
System.out.println( e.toString() );
}
writer.close();
}
The above code uses Castor's Java Bean marshaller.
http://www.castor.org/xml-mapping.html
Don't like the default marshalling behavior? Change it with a mapping file
(XML format).
Unfortunately Castor is written in, and only works with, dirty old Java.
However Castor code is open source, so porting it to Smalltalk is possible
by motivated individuals such as yourself.
|