I wrote a quick serialization routine using XMLEncoder and got the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0_25" class="java.beans.XMLDecoder">
<object class="edu.stevens.Test">
<void property="id">
<int>1</int>
</void>
<void property="name">
<string>Fred</string>
</void>
</object>
</java>
I would like to define tags that are more meaningful, not to mention more compact. Something like this:
<Test>
<id>1</id>
<name>Fred</name>
</Test>
I would not mind embedding the package names in the file once, but don't want it replicated every time since it can get huge.
Obviously, I could do this by letting serialization do its thing, then run an XSLT translation step afterward, but that is slow and cumbersome.
If there is any way to define mappings of tags to objects, that would be my number one choice. If not, is there any other XML serialization tool that would work?
No comments:
Post a Comment