<xmlProperty2>
<xmlproperty>
task, but maps the XML
DOM in a different, more detailed way.
This task is the inversion of the <propertyXml2>
task.
Sets the following properties for the root element of the XML document:
prefix0.root-element-name.$$ = all-texts prefix0.root-element-name._att1-name = att1-value prefix0.root-element-name._att2-name = att2-value prefix0.root-element-name.index.$ = text prefix0.root-element-name.index.# = comment prefix0.root-element-name.index.! = cdata-text prefix0.root-element-name.index.? = processing-instruction-target-and-data
Sets the following properties for all other elements in the XML document:
...parent-element-name.index.subelement-name.$$ = all-texts ...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
*.$$
" indicates the existence of the respective element in the XML
document.
This document
<?xml version='1.0' encoding='UTF-8'?> <project name="prj1"> <target name="trg1"> <echo message="msg" /> </target> </project>
sets the following properties:
prefix.0.project.$$ = prefix.0.project._name = prj1 prefix.0.project.0.$ = \n\t prefix.0.project.1.target.$$ = prefix.0.project.1.target._name = trg1 prefix.0.project.1.target.0.$ = \n\t\t prefix.0.project.1.target.1.echo.$$ = prefix.0.project.1.target.1.echo._message = msg prefix.0.project.1.target.2.$ = \n\t prefix.0.project.2.$ = \n
<xmlProperty2>
" and "</xmlProperty2>
" will also be parsed as an XML
document.
It may be useful to use a CDATA section, e.g.:
<xmlProperty2 prefix="prefix.">
<![CDATA[<?xml version='1.0' encoding='UTF-8'?>
<project name="prj1">
<target name="trg1">
<echo message="msg" />
</target>
</project>
]]>
</xmlProperty2>
Name | Description |
---|---|
failOnError="..."
|
Whether the task fails when the first (non-fatal) error occurrs while parsing the XML document. |
failOnWarning="..."
|
Whether the task fails when the first warning occurrs while parsing the XML document. |
file="..."
|
The file to read an XML document from. |
lexical="..."
|
Whether to also set properties for comments and CDATA sections. |
prefix="..."
|
This prefix is prepended to each property being set. |
suppressErrors="..."
|
Whether (non-fatal) errors are not to be logged. |
suppressWarnings="..."
|
Whether warnings are not to be logged. |
Name | Description |
---|---|
Any ResourceCollection | All resources will be parsed as XML documents. |
Default values are underlined.
prefix="prefix"
failOnWarning="true|false"
failOnError="true|false"
Copyright © 2019. All rights reserved.