Hello Alexander, > Assuming that, for an instance of StringAttribute, I have key="foo" and > value="bar", I'd like to map this to XML looking like
> <foo>bar</foo> > Can this be done with Castor (or <insert mapping tool here>)? I'll > happily write some custom code to do it, as long as I don't have to > create DOM documents from scratch. As you are asking for other mapping tools, you might also look at my little XML Storage library here: http://www.sky.franken.de/xmlstorage/ I am using it for projects, which don't require such a huge library as Castor. There is a C++ and a Java version - the interface of both is nearly identical. Creating a XML dodument is just as simple as this example: XMLDoc doc = new XMLDoc(); XMLPos pos = new XMLPos(doc); // create the XML tree in memory pos.create("root"); pos.create("foo"); pos.setContent("bar"); pos.back(); // </foo> pos.create("foo2"); pos.put("attr1", "value1"); pos.put("attr2", "value2"); pos.create("foo3"); pos.setContent("bar2"); pos.back(); pos.back(); pos.back(); // </root> // write the XML file doc.write("test.xml"); This way you get an output file like this: <?xml version="1.0" encoding="UTF-8"?> <root> <foo>bar</foo> <foo2 attr1="value1" attr2="value2"> <foo3>bar2</foo3> </foo2> </root> Regards, Martin

