|MOXy: Insert/Replacement scenario using Xpath [message #1067164]
||Sun, 07 July 2013 00:43
| Tim Braun
Registered: July 2013
Suppose I have a very simple input exmaple XML file as follows|
I would like to modify the xml structure by inserting additional elements anywhere in the original structure, or replace an element with other content.
Can I somehow achieve that using EclipseLink MOXy? E.g. I want to to replace "some" by "someReplacement" and add "whatever".
The actual XML I want to process is more complex, however I only actually deal with a small subset of its content, so I would prefer not to unmarshall the complete file into a complex bean structure, make changes to a small set of elements, and marshall the whole structure back into a file. At least I don't want to know about the complexity.
This is because the input XML schema can vary greatly, but the specific elements I care about exist in each of these schema. So I would ideally want to find a solution to e.g. adapt XPaths in something like a bindings file to point to the elements I want to replace/insert.
I would prefer not to use JDOM, because the elements I produce for insertion/replacement are complex and I don't want to create them 'by hand' but instead have some bean structure be mapped.
Can I do this with MOXy? Any other JAXB provider? Should I use JDOM, or is there anything else that could help?
[Updated on: Sun, 07 July 2013 01:13]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02998 seconds