<propertyXml2>
<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=" 	" /> <property name="prefix.0.project.1.target._name" value="trg1" /> <property name="prefix.0.project.1.target.0.$" value=" 		" /> <property name="prefix.0.project.1.target.1.echo._message" value="msg" /> <property name="prefix.0.project.1.target.2.$" value=" 	" /> <property name="prefix.0.project.2.$" value=" " /> <propertyXml2 prefix="prefix." />
generates this XML document:
<?xml version='1.0' encoding='UTF-8'?> <project name="prj1"> <target name="trg1"> <echo message="msg" /> </target> </project>
Notice that "
" denotes a line break and "	
" 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.
Name | Description |
---|---|
file="..."
|
The file to store the XML document in. |
prefix="..."
|
Determines which properties are used; see task description. |
Copyright © 2019. All rights reserved.