You can override the default rules for tag combination by setting the xml-combine
attribute in tags of the last-read configuration file. xml-combine
can be set to one of the following values:
Note: The xml-combine
attribute is removed from the combined file.
replace
Only the tag in file2.xml
is used; the tag in file1.xml
is ignored. for example:
File1.xml
<people> <person name="joe"> <interests> <interest interest="rollerblading"/> <interest interest="bass"/> </interests> </person> </people>
File2.xml
<people> <person name="joe" xml-combine="replace"> <interests> <interest interest="parenting"/> </interests> </person> </people>
Result
<people> <person name="joe"> <interests> <interest interest="parenting"/> </interests> </person> </people>
remove
The tag is removed from the combined file. For example:
File1.xml
<people> <person name="joe"> <interests> <interest interest="rollerblading"/> <interest interest="bass"/> </interests> </person> </people>
File2.xml
<people> <person name="joe" xml-combine="remove"/> </people>
Result
<people> </people>
append
The contents of file2.xml
’s tag are appended to the contents of file1.xml
’s tag. For example:
File1.xml
<people> <person name="joe"> <interests> <interest interest="rollerblading"/> <interest interest="bass"/> </interests> </person> </people>
File2.xml
<people> <person name="joe"> <interests xml-combine="append"> <interest interest="parenting"/> </interests> </person> </people>
Result
<people> <person name="joe"> <interests> <interest interest="rollerblading"/> <interest interest="bass"/> <interest interest="parenting"/> </interests> </person> </people>
Embedded tags are matched and combined recursively.
append-without-matching
Identical to xml-combine="append"
, except embedded tags are not matched and combined recursively. Tag content is simply appended.
prepend
The contents of file2.xml
’s tag are prepended to the contents of file1.xml
’s tag. For example:
File1.xml
<people> <person name="joe"> <interests> <interest interest="rollerblading"/> <interest interest="bass"/> </interests> </person> </people>
File2.xml
<people> <person name="joe"> <interests xml-combine="prepend"> <interest interest="parenting"/> </interests> </person> </people>
Result
<people> <person name="joe"> <interests> <interest interest="parenting"/> <interest interest="rollerblading"/> <interest interest="bass"/> </interests> </person> </people>
Embedded tags are matched and combined recursively (see the Recursive Combination).
prepend-without-matching
Identical to prepend
, except embedded tags are not matched and combined recursively. Tag content is simply prepended.