In this section, we’ll call the tag from the first file tag1, and the tag from the second file tag2. When two tags are matched up, the way that they are combined is defined by an extra attribute that is specified in tag2 called xml-combine. This attribute is used only to specify how the tags are combined, and is removed before the resulting file is generated. The xml-combine attribute can have the following values:

xml-combine=“replace”

The tag appears in the resulting file with just the contents and attributes from tag2. The contents from tag1 are ignored. For example:

File 1

File 2

Result

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

<people>
  <person name="joe"
xml-combine="replace">
    <interests>
      <interest interest="parenting"/>
    </interests>
  </person>
</people>

<people>
  <person name="joe">
    <interests>
      <interest interest="parenting"/>
    </interests>
  </person>
</people>

xml-combine=“remove”

The tag does not appear in the resulting file at all. For example:

File 1

File 2

Result

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

<people>
  <person name="joe"
     xml-combine="remove"/>
</people>

<people>
</people>

xml-combine=“append”

The tag appears in the resulting file. Its value is the contents of tag2 appended to the contents of tag1. For example:

File 1

File 2

Result

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

<people>
  <person name="joe">
    <interests xml-combine="append">
      <interest interest="parenting"/>
    </interests>
  </person>
</people>

<people>
  <person name="joe">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
      <interest interest="parenting"/>
    </interests>
  </person>
</people>

Any embedded tags are matched and combined recursively (see below).

xml-combine=“append-without-matching”

This is the same as xml-combine="append", except that embedded tags are not matched and combined recursively. The content is simply appended.

xml-combine=“prepend”

The tag appears in the resulting file. Its value is the contents of tag2 prepended to the contents of tag1. For example:

File 1

File 2

Result

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

<people>
  <person name="joe">
    <interests xml-combine="prepend">
      <interest interest="parenting"/>
    </interests>
  </person>
</people>

<people>
  <person name="joe">
    <interests>
      <interest interest="parenting"/>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</people>

Any embedded tags are matched and combined recursively. See the Matching Tags topic in this section.

xml-combine=“prepend-without-matching”

This is the same as “prepend”, except that embedded tags are not matched and combined recursively. The content is simply prepended.

 
loading table of contents...