Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » MOXy: Insert/Replacement scenario using Xpath
MOXy: Insert/Replacement scenario using Xpath [message #1067164] Sat, 06 July 2013 20:43
Tim Braun is currently offline Tim Braun
Messages: 8
Registered: July 2013
Junior Member
Suppose I have a very simple input exmaple XML file as follows
<?xml version="1.0"?>
    <some />

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".
<?xml version="1.0"?>
    <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: Sat, 06 July 2013 21:13]

Report message to a moderator

Previous Topic:Eclipse link DBWS -Connection is null
Next Topic:Customizing schema generation
Goto Forum:

Current Time: Fri Aug 29 06:14:13 EDT 2014

Powered by FUDForum. Page generated in 0.09191 seconds