...
Code Block |
---|
|
<?xml version="1.0"?>
<test>
<a></a>
<!-- <b></b> -->
</test> |
Info |
---|
In the <parsable> tag don't use the type="xml" for this example, because it would replace the characters '<' and '>' in your comment XML elements by '<' and '>' in the resulting output. |
Values from Environment Variables
...
Code Block |
---|
lang | xml |
---|
title | Assigning a dynamic variable value from the Windows registry |
---|
|
<dynamicvariables>
<variable name="RegistryReadTest" checkonce="true"
regkey="HKLMHKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
regvalue="Path"/>
</dynamicvariables>
|
...
Code Block |
---|
lang | xml |
---|
title | Filtering dynamic variable assignments using regular expressions |
---|
|
<dynamicvariables>
<!--
Read the property value of release.version in the resource release.properties from the root of the config.jar file.
Filter just the version string from the result, if there is one, otherwise return 'none'.
-->
<variable name="previous.version" jarfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/config.jar"
entry="release.properties" type="options"
key="release.version"
checkonce="false" ignorefailure="true" condition="upgradecheck">
<filters>
<regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="none"/>
</filters>
</variable>
<!--
Read the value of the Windows system environment variable %PATH% directly from the Windows registry (can done smarter by ${SYSTEM[PATH]}).
Filter just the first single path (if there are more separated by the ';' character). If there was a valid value, otherwise return '(unmatched)'.
-->
<variable name="RegExTest.Select.Windows" checkonce="true"
regkey="HKLMHKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
regvalue="Path">
<filters>
<regex regexp="([^;]*)(.*)"
select="\1"
defaultvalue="(unmatched)"
casesensitive="false"/>
</filters>
</variable>
<!--
Read the value of the Windows system environment variable %PATH% directly from the Windows registry (can done smarter by ${SYSTEM[PATH]}).
Filter just the first single path (if there are more separated by the ';' character).
Prepend and append three plus signs to the resulting value, if there was a valid value, otherwise return '(unmatched)'.
-->
<variable name="RegExTest.ReplaceFirst.Windows" checkonce="true"
regkey="HKLMHKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
regvalue="Path">
<filters>
<regex regexp="([^;]*)"
replace="+++ \1 +++"
defaultvalue="(unmatched)"
casesensitive="false"
global="false"/>
</filters>
</variable>
</dynamicvariables>
|
After straight evaluation, each dynamic variable value can be filtered to be canonicalized like a filename. This is done by the nested location element. Operating system-specific path conventions are considered when assembling the result.
...