Task for setting properties from an XML file in buildfiles.

Use Project#createTask to register a new Task.

author | Jonathan Bond-Caron
version | $Id: c7a3e7eff0b94828f9ec634c3612d89f2740fead $
package | phing.tasks.ext
since | 2.4.0
link | http://ant.apache.org/manual/CoreTasks/xmlproperty.html
copyright | 2001,2002 THYRELL. All rights reserved

### Methods

## Sets value of property to CDATA tag contents.

    addText($value)

Inherited

since | 2.2.0
inherited_from | \PropertyTask::addText()

### Parameters

#### $value

## Creates a filterchain

    createFilterChain() : object

Inherited

access | public
inherited_from | \PropertyTask::createFilterChain()

### Returns

`object`The created filterchain object

## getCollapseAttributes()

    getCollapseAttributes() : bool

### Returns

`bool`

## getDelimiter()

    getDelimiter() : string

### Returns

`string`

## Returns the textual description of the task

    getDescription() : string

Inherited

inherited_from | \Task::getDescription()
inherited_from | \PropertyTask::getDescription()

### Returns

`string`The text description of the task

## getEnvironment()

    getEnvironment()

Inherited

inherited_from | \PropertyTask::getEnvironment()

## getFallback()

    getFallback()

Inherited

inherited_from | \PropertyTask::getFallback()

## Get the PhingFile that is being used as property source.

    getFile()

## getKeepRoot()

    getKeepRoot() : bool

### Returns

`bool`

## Returns the location within the buildfile this task occurs.

    getLocation() : \Location

Inherited

Used by BuildException to give detailed error messages.

inherited_from | \Task::getLocation()
inherited_from | \PropertyTask::getLocation()

### Returns

`\Location`The location object describing the position of this task within the buildfile.

## Get property component name.

    getName()

Inherited

inherited_from | \PropertyTask::getName()

## getOverride()

    getOverride()

Inherited

inherited_from | \PropertyTask::getOverride()

## Returns the owning target of this task.

    getOwningTarget() : \Target

Inherited

inherited_from | \Task::getOwningTarget()
inherited_from | \PropertyTask::getOwningTarget()

### Returns

`\Target`The target object that owns this task

## getPrefix()

    getPrefix() : string

since | 2.0

### Returns

`string`

## Returns a reference to current project

    getProject() : \Project

Inherited

inherited_from | \ProjectComponent::getProject()
inherited_from | \Task::getProject()
inherited_from | \PropertyTask::getProject()

### Returns

`\Project`Reference to current porject object

## getRefid()

    getRefid()

Inherited

inherited_from | \PropertyTask::getRefid()

## getRequired()

    getRequired() : string

### Returns

`string`

## Returns the wrapper object for runtime configuration

    getRuntimeConfigurableWrapper() : \RuntimeConfigurable

Inherited

inherited_from | \Task::getRuntimeConfigurableWrapper()
inherited_from | \PropertyTask::getRuntimeConfigurableWrapper()

### Returns

`\RuntimeConfigurable`The wrapper object used by this task

## Returns the name of task, used only for log messages

    getTaskName() : string

Inherited

inherited_from | \Task::getTaskName()
inherited_from | \PropertyTask::getTaskName()

### Returns

`string`Name of this task

## Returns the name of the task under which it was invoked, usually the XML tagname

    getTaskType() : string

Inherited

inherited_from | \Task::getTaskType()
inherited_from | \PropertyTask::getTaskType()

### Returns

`string`The type of this task (XML Tag)

## getUserProperty()

    getUserProperty()

Inherited

inherited_from | \PropertyTask::getUserProperty()

## Get the value of current property component.

    getValue()

Inherited

inherited_from | \PropertyTask::getValue()

## Called by the parser to let the task initialize properly.

    init()

Inherited

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

inherited_from | \Task::init()
inherited_from | \PropertyTask::init()

### Exceptions

`\BuildException` |

## Provides a project level log event to the task.

    log(string $msg, integer $level)

Inherited

see | \global\BuildEvent
see | \global\BuildListener
inherited_from | \Task::log()
inherited_from | \PropertyTask::log()

### Parameters

#### $msg

`string`

The message to log

#### $level

`integer`

The priority of the message

## set the property in the project to the value.

    main()

if the task was give a file or env attribute here is where it is loaded

## Configure this task if it hasn't been done already.

    maybeConfigure()

Inherited

inherited_from | \Task::maybeConfigure()
inherited_from | \PropertyTask::maybeConfigure()

## Perfrom this task

    perform()

Inherited

inherited_from | \Task::perform()
inherited_from | \PropertyTask::perform()

## Treat attributes as nested elements.

    setCollapseAttributes(bool $yesNo)

### Parameters

#### $yesNo

`bool`

## Delimiter for splitting multiple values.

    setDelimiter(string $d)

### Parameters

#### $d

`string`

## Sets a textual description of the task

    setDescription(string $desc)

Inherited

inherited_from | \Task::setDescription()
inherited_from | \PropertyTask::setDescription()

### Parameters

#### $desc

`string`

The text describing the task

## the prefix to use when retrieving environment variables.

    setEnvironment(\env $env)

Inherited

Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".

<

p> Note that if you supply a property name with a final "." it will not be doubled. ie environment="myenv." will still allow access of environment variables through "myenv.PATH" and "myenv.TERM". This functionality is currently only implemented on select platforms. Feel free to send patches to increase the number of platforms this functionality is supported on ;).
Note also that properties are case sensitive, even if the environment variables on your operating system are not, e.g. it will be ${env.Path} not ${env.PATH} on Windows 2000.

inherited_from | \PropertyTask::setEnvironment()

### Parameters

#### $env

`\env`

prefix

## setFallback()

    setFallback(\Project $p)

Inherited

inherited_from | \PropertyTask::setFallback()

### Parameters

#### $p

`\Project`

## Set a file to use as the source for properties.

    setFile($file)

### Parameters

#### $file

## Keep the xml root tag as the first value in the property name

    setKeepRoot(bool $yesNo)

### Parameters

#### $yesNo

`bool`

## Sets the location within the buildfile this task occurs.

    setLocation(\Location $location)

Inherited

Called by the parser to set location information.

inherited_from | \Task::setLocation()
inherited_from | \PropertyTask::setLocation()

### Parameters

#### $location

`\Location`

The location object describing the position of this task within the buildfile.

## Sets a the name of current property component

    setName($name)

Inherited

inherited_from | \PropertyTask::setName()

### Parameters

#### $name

## setOverride()

    setOverride($v)

Inherited

inherited_from | \PropertyTask::setOverride()

### Parameters

#### $v

## Sets the owning target this task belongs to.

    setOwningTarget(\Target $target)

Inherited

inherited_from | \Task::setOwningTarget()
inherited_from | \PropertyTask::setOwningTarget()

### Parameters

#### $target

`\Target`

Reference to owning target

## Prefix to apply to properties loaded using <code>file</code>.

    setPrefix(string $prefix) : void

A "." is appended to the prefix if not specified.

since | 2.0

### Parameters

#### $prefix

`string`

prefix string

## References the project to the current component.

    setProject(\Project $project)

Inherited

inherited_from | \ProjectComponent::setProject()
inherited_from | \Task::setProject()
inherited_from | \PropertyTask::setProject()

### Parameters

#### $project

`\Project`

The reference to the current project

## setRefid()

    setRefid(\Reference $ref)

Inherited

inherited_from | \PropertyTask::setRefid()

### Parameters

#### $ref

## File required or not.

    setRequired(string $d)

### Parameters

#### $d

`string`

## Sets the wrapper object this task should use for runtime configurable elements.

    setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)

Inherited

inherited_from | \Task::setRuntimeConfigurableWrapper()
inherited_from | \PropertyTask::setRuntimeConfigurableWrapper()

### Parameters

#### $wrapper

`\RuntimeConfigurable`

The wrapper object this task should use

## Sets the name of this task for log messages

    setTaskName(string $name) : string

Inherited

inherited_from | \Task::setTaskName()
inherited_from | \PropertyTask::setTaskName()

### Parameters

#### $name

`string`

### Returns

`string`A string representing the name of this task for log

## Sets the type of the task.

    setTaskType(string $name)

Inherited

Usually this is the name of the XML tag

inherited_from | \Task::setTaskType()
inherited_from | \PropertyTask::setTaskType()

### Parameters

#### $name

`string`

The type of this task (XML Tag)

## Set whether this is a user property (ro).

    setUserProperty(boolean $v)

Inherited

This is deprecated in Ant 1.5, but the userProperty attribute of the class is still being set via constructor, so Phing will allow this method to function.

inherited_from | \PropertyTask::setUserProperty()

### Parameters

#### $v

`boolean`

## Sets a the value of current property component.

    setValue(mixed $value)

Inherited

inherited_from | \PropertyTask::setValue()

### Parameters

#### $value

`mixed`

Value of name, all scalars allowed

## toString()

    toString()

Inherited

inherited_from | \PropertyTask::toString()

## Adds an XML node

    _addNode(\SimpleXMLElement $node, array $path, \Properties $prop) : void

### Parameters

#### $node

`\SimpleXMLElement`

#### $path

`array`

Path to this node

#### $prop

`\Properties`

Properties will be added as they are found (by reference here)

## Parses an XML file and returns properties

    _getProperties(string $filePath) : \Properties

### Parameters

#### $filePath

`string`

### Returns

`\Properties`

## iterate through a set of properties, resolve them then assign them

    addProperties($props)

Inherited

inherited_from | \PropertyTask::addProperties()

### Parameters

#### $props

## add a name value pair to the project property set

    addProperty(string $name, string $value)

Inherited

inherited_from | \PropertyTask::addProperty()

### Parameters

#### $name

`string`

name of property

#### $value

`string`

value to set

## Returns a name

    getRegisterSlot(string $slotName)

Inherited

inherited_from | \Task::getRegisterSlot()
inherited_from | \PropertyTask::getRegisterSlot()

### Parameters

#### $slotName

`string`

## load the environment values

    loadEnvironment(string $prefix)

Inherited

inherited_from | \PropertyTask::loadEnvironment()

### Parameters

#### $prefix

`string`

prefix to place before them

## load properties from an XML file.

    loadFile(\PhingFile $file)

### Parameters

#### $file

`\PhingFile`

## This method will parse a string containing ${value} style property values into two lists.

    parsePropertyString(string $value, array $fragments, array $propertyRefs)

Inherited

The first list is a collection of text fragments, while the other is a set of string property names null entries in the first list indicate a property reference from the second list.

This is slower than regex, but useful for this class, which has to handle multiple parsing passes for properties.

inherited_from | \PropertyTask::parsePropertyString()

### Parameters

#### $value

`string`

The string to be scanned for property references

#### $fragments

`array`

&$fragments The found fragments

#### $propertyRefs

`array`

&$propertyRefs The found refs

## Given a Properties object, this method goes through and resolves any references to properties within the object.

    resolveAllProperties(\Properties $props) : void

Inherited

inherited_from | \PropertyTask::resolveAllProperties()

### Parameters

#### $props

`\Properties`

The collection of Properties that need to be resolved.

### Properties

##

    $description : string

Inherited

inherited_from | \Task::$$description
inherited_from | \PropertyTask::$$description

##

    $env

Inherited

inherited_from | \PropertyTask::$$env

##

    $fallback

Inherited

inherited_from | \PropertyTask::$$fallback

##

    $file

Inherited

inherited_from | \PropertyTask::$$file

##

    $filterChains

Inherited

inherited_from | \PropertyTask::$$filterChains

##

    $location : \Location

Inherited

inherited_from | \Task::$$location
inherited_from | \PropertyTask::$$location

##

    $name

Inherited

inherited_from | \PropertyTask::$$name

##

    $override

Inherited

inherited_from | \PropertyTask::$$override

##

    $prefix

Inherited

inherited_from | \PropertyTask::$$prefix

##

    $project : \Project

Inherited

inherited_from | \ProjectComponent::$$project
inherited_from | \Task::$$project
inherited_from | \PropertyTask::$$project

##

    $ref

Inherited

inherited_from | \PropertyTask::$$ref

##

    $reference

Inherited

inherited_from | \PropertyTask::$$reference

##

    $target : \Target

Inherited

inherited_from | \Task::$$target
inherited_from | \PropertyTask::$$target

##

    $taskName : string

Inherited

inherited_from | \Task::$$taskName
inherited_from | \PropertyTask::$$taskName

##

    $taskType : string

Inherited

inherited_from | \Task::$$taskType
inherited_from | \PropertyTask::$$taskType

##

    $userProperty

Inherited

inherited_from | \PropertyTask::$$userProperty

##

    $value

Inherited

inherited_from | \PropertyTask::$$value

##

    $wrapper : \RuntimeConfigurable

Inherited

inherited_from | \Task::$$wrapper
inherited_from | \PropertyTask::$$wrapper

##

    $_collapseAttr

##

    $_delimiter

##

    $_keepRoot

##

    $_required