segunda-feira, 29 de junho de 2015

XML Files Combination

    An XML file might appear at several points in the CONFIGPATH. The ATG platform, at runtime, automatically combines all the XML files in the CONFIGPATH with the same name into a single composite file, which is then used by the appropriate component.
    When two files are matched up, the way that they are combined is defined by an extra attribute that is specified in file 2 called xml-combine. This attribute is used only to specify how the files are combined, and is removed before the resulting file is generated. The xml-combine attribute can have the following values:

  • xml-combine="replace"
  • xml-combine="remove"
  • xml-combine="append"
  • xml-combine="append-without-matching"
  • xml-combine="prepend"
  • xml-combine="prepend-without-matching"


xml-combine="replace"
File 1:
<people>
  <person name="joe">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</people>
File 2:
<people>
  <person name="joe" xml-combine="replace">
    <interests>
      <interest interest="parenting"/>
    </interests>
  </person>
</people>
Resulting File:
<people>
  <person name="joe">
    <interests>
      <interest interest="parenting"/>
    </interests>
  </person>
</people>


xml-combine="remove"
File 1:
<people>
  <person name="joe">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</people>
File 2:
<people>
  <person name="joe" xml-combine="remove"/>
</people>
Resulting File:
<people>
</people>


xml-combine="append"
File 1:
<people>
  <person name="joe">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</people>
File 2:
<people>
  <person name="joe">
    <interests xml-combine="append">
      <interest interest="parenting"/>
    </interests>
  </person>
</people>
Resulting File:
<people>
  <person name="joe">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
      <interest interest="parenting"/>
    </interests>
  </person>
</people>


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


xml-combine="prepend"
File 1:
<people>
  <person name="joe">
    <interests>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</people>
File 2:
<people>
  <person name="joe">
    <interests xml-combine="prepend">
      <interest interest="parenting"/>
    </interests>
  </person>
</people>
Resulting File:
<people>
  <person name="joe">
    <interests>
      <interest interest="parenting"/>
      <interest interest="rollerblading"/>
      <interest interest="bass"/>
    </interests>
  </person>
</people>


xml-combine="prepend-without-matching"
This is the same as "prepend", except that embedded files are not matched and combined recursively. The content is simply prepended.


References:

Nenhum comentário:

Postar um comentário