antology 2.0.7


Creates an XML document from ANT properties; the counterpart of the <xmlProperty2> task.

Uses the following properties to create the root element of the XML document:

prefix.0.root-element-name._att1-name = att1-value
prefix.0.root-element-name._att2-name = att2-value
prefix.0.root-element-name.index.$    = text
prefix.0.root-element-name.index.#    = comment
prefix.0.root-element-name.index.!    = cdata-text
prefix.0.root-element-name.index.?    = processing-instruction-target-and-data

The indexes must be integral values (typically, but not necessarily starting at zero and increasing with step size 1), and determine the order of the subnodes. In addition to text, comment, cdata, processing instruction and entity nodes, subelements, sub-subelements and so forth can be defined in the same manner:

...parent-element-name.index.subelement-name._att1-name = att1-value
...parent-element-name.index.subelement-name._att2-name = att2-value
...parent-element-name.index.subelement-name.index.$    = text
...parent-element-name.index.subelement-name.index.#    = comment
...parent-element-name.index.subelement-name.index.!    = cdata-text
...parent-element-name.index.subelement-name.index.?    = processing-instruction-target-and-data


The build script

 <property name="prefix.0.project._name"                    value="prj1"          />
 <property name="prefix.0.project.0.$"                      value="&#10;&#9;"     />
 <property name=""           value="trg1"          />
 <property name="$"             value="&#10;&#9;&#9;" />
 <property name="" value="msg"           />
 <property name="$"             value="&#10;&#9;"     />
 <property name="prefix.0.project.2.$"                      value="&#10;"         />
 <propertyXml2 prefix="prefix." />

generates this XML document:

 <?xml version='1.0' encoding='UTF-8'?>
 <project name="prj1">
     <target name="trg1">
         <echo message="msg" />

Notice that "&#10;" denotes a line break and "&#9;" a TAB character. If you don't care about proper indentation, you can leave out the "...$" properties.

This task is the inversion of the <xmlProperty2> task. Notice that the "...$$" properties which <xmlProperty2> sets (which are entirely redundant) are not used by this task.

antology 2.0.7

Copyright © 2019. All rights reserved.