Reputation: 1407
What is the best practice for XML change/update/add new info using Java, in a way so that Info node/comments still remain intact and formatting also. Please guide....
Can we achieve this in JixB?
Upvotes: 1
Views: 629
Reputation: 16392
XML comments are treated as nodes like any other XML node (elements, etc.) and the whitespace that formats the XML nicely is treated as Text nodes. So your question is really how to maintain those comment and text nodes as you use something like JixB to construct your Java objects from the XML.
I don't don't know whether JixB maintains the nested comment and text nodes so that when you persist the data as XML the comments and formatting remains the same.
If you're going directly against the Dom, though, you can know that those extra nodes exist in the DOM and take care to maintain them as you update the XML as well as insert new comment and text nodes to add that formatting style around newly added data.
Upvotes: 1