How to transform attributes and text elements during XML parsing with JAXB?
I have an almost standard task of parsing an XML document into java object using JAXB, only with one quirk. All the text elements and attribute values should pass through a variable expansion. I have the expansion engine but don’t know how to plug it into the parser.
Of course I can walk through the final java object graph and apply expansion to all the String fields. But this is a bad solution, because graph’s structure is quite complicated and is subject to frequent changes.
In "variable expansion" I mean transforming e.g. "Hi, $user!" into "Hi, John Doe!".
What is the simplest solution?