The above rules specify how two tags are supposed to be combined. However, an additional rule is required to specify how two XML files must be combined.

The rule for combining two XML files is to act as if each file were completely enclosed in a tag, that tag matched for both files, and the tags are being combined with mode “append”. For example, consider two XML files:

File 1

File 2

<person name="joe" title="CTO">
  <interests>
    <interest interest="rollerblading"/>
    <interest interest="bass"/>
  </interests>
</person>

<person name="jeet" title="CEO">
  <interests>
    <interest interest="parenting"/>
  </interests>
</person>
<person name="joe" xml-combine="append">
  <interests xml-combine="prepend">
    <interest interest="parenting"/>
  </interests>
</person>

Notice that the <people> tag has been removed for the purpose of this example. In this case, the XML files should act as if they were defined like this:

File 1

File 2

<pretend-enclosing-tag>
  <person name="joe" title="CTO">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</pretend-enclosing-tag>

<pretend-enclosing-tag
      xml-combine="append">
  <person name="jeet" title="CEO">
    <interests>
      <interest interest="parenting"/>
    </interests>
  </person>
  <person name="joe" xml-combine="append">
    <interests xml-combine="prepend">
      <interest interest="parenting"/>
    </interests>
  </person>
</pretend-enclosing-tag>

The enclosing tags are then combined as normal, and the resulting file is the result of the combination, without the enclosing tag.

 
loading table of contents...