Because XML structure is complex, the source file of the node is the hundreds of, new XML file node will be a lot more, create a Java object is complicated, so excuse me what is the simple and effective method for XML transformation?
Similar to the original XML node corresponding to the new XML node this way?
Assumes that the structure is:
Will be converted to:
<? The XML version="1.0" encoding="utf-8"?>
.
CodePudding user response:
Individuals will take reliance on file to transform, is simply aI'll write your own before into a new XML structure a conversion file structure, such as
The root for the transformation after the tag name it will have a
Parent: whether there is a parent
Value: the value
OldTag: old tag name
And so on these parameters, so when I convert only need to read the configuration file and then to convert the recursion, and said, my own control, do conversion program
, of course, this approach is only applicable to structure may be changing, or add a new tag,
If you is there is a kind of specific rules for transformation, and the rules are the same, that in this way can be trouble
CodePudding user response:
Look at the, actually not difficult also,First of all, is a new structure contains old structures, so a new structure, containing the old structure
Then, the old structure part of the name change, so, if use annotations, modify the old structure of the annotations, if no comment, oneself do a converter, read to a specific old tag name do a conversion into a new tag name