C.98 XmlPropertyTask

Loads property values from a well-formed xml file. There are no other restrictions than "well-formed".

Table C.128: Attributes

NameTypeDescriptionDefaultRequired
fileStringThe XML file to parse.n/aYes
prefixStringThe prefix to prepend to each propertyn/aNo
keepRootBooleanKeep the xml root tag as the first value in the property name.trueNo
collapseAttributesBooleanTreat attributes as nested elements.falseNo
delimiterStringDelimiter for splitting multiple values.,No
requiredBooleanIf this is set to true then a build exception will be raised if the file cannot be found otherwise only a warning will be logged.falseNo

C.98.1 Example

Consider the following XML file:

<root-tag myattr="true">
    <inner-tag someattr="val">Text</inner-tag>
    <a2><a3><a4>false</a4></a3></a2>
</root-tag>

Used with the following entry (default):

<xmlproperty file="somefile.xml"/>

results in the following properties:

root-tag(myattr)=true
root-tag.inner-tag=Text
root-tag.inner-tag(someattr)=val
root-tag.a2.a3.a4=false

Used with the following entry (collapseAttributes=true):

<xmlproperty file="somefile.xml" collapseAttributes="true"/>

results in the following properties:

root-tag.myattr=true
root-tag.inner-tag=Text
root-tag.inner-tag.someatt=val
root-tag.a2.a3.a4=false

Used with the following entry (keepRoot=false):

<xmlproperty file="somefile.xml" keepRoot="false"/>

results in the following properties:

inner-tag=Text
inner-tag(someattr)=val
a2.a3.a4=false