Package org.apache.tools.ant.helper

# Class AntXMLContext

java.lang.Object
org.apache.tools.ant.helper.AntXMLContext

public class AntXMLContext extends Object
Context information for the ant processing.

## Constructor Summary

Constructors
Constructor
Description
`AntXMLContext(Project project)`
constructor

## Method Summary

Modifier and Type
Method
Description
`void`
`addTarget(Target target)`
add a new target
`void`
`configureId(Object element, Attributes attr)`
Scans an attribute list for the `id` attribute and stores a reference to the target object in the project if an id is found.
`RuntimeConfigurable`
`currentWrapper()`
get the current runtime configurable wrapper can return null
`void`
`endPrefixMapping(String prefix)`
End of prefix to uri mapping.
`File`
`getBuildFile()`
find out the build file
`File`
`getBuildFileParent()`
find out the parent build file of this build file
`URL`
`getBuildFileParentURL()`
find out the parent build file of this build file
`URL`
`getBuildFileURL()`
find out the build file
`String`
`getCurrentProjectName()`
find out the current project name
`Target`
`getCurrentTarget()`
get the current target
`Map<String,Target>`
`getCurrentTargets()`
Get the targets in the current source file.
`Target`
`getImplicitTarget()`
get the implicit target
`Locator`
`getLocator()`
access the locator
`String`
`getPrefixMapping(String prefix)`
prefix to namespace uri mapping
`Project`
`getProject()`
find out the project to which this antxml context belongs
`Vector<Target>`
`getTargets()`
access the vector of targets
`Vector<RuntimeConfigurable>`
`getWrapperStack()`
access the stack of wrappers
`boolean`
`isIgnoringProjectTag()`
tells whether the project tag is being ignored
`RuntimeConfigurable`
`parentWrapper()`
get the runtime configurable wrapper of the parent project can return null
`void`
`popWrapper()`
remove a runtime configurable wrapper from the stack
`void`
`pushWrapper(RuntimeConfigurable wrapper)`
add a runtime configurable wrapper to the internal stack
`void`
`setBuildFile(File buildFile)`
sets the build file to which the XML context belongs
`void`
`setBuildFile(URL buildFile)`
sets the build file to which the XML context belongs
`void`
`setCurrentProjectName(String name)`
set the name of the current project
`void`
`setCurrentTarget(Target target)`
sets the current target
`void`
`setCurrentTargets(Map<String,Target> currentTargets)`
Set the map of the targets in the current source file.
`void`
`setIgnoreProjectTag(boolean flag)`
sets the flag to ignore the project tag
`void`
`setImplicitTarget(Target target)`
sets the implicit target
`void`
`setLocator(Locator locator)`
sets the locator
`void`
`startPrefixMapping(String prefix, String uri)`
Called during parsing, stores the prefix to uri mapping.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AntXMLContext

public AntXMLContext(Project project)
constructor

Parameters:
  `project` - the project to which this antxml context belongs to

## Method Details

### setBuildFile

public void setBuildFile(File buildFile)
sets the build file to which the XML context belongs

Parameters:
  `buildFile` - ant build file

### setBuildFile

public void setBuildFile(URL buildFile) throws MalformedURLException
sets the build file to which the XML context belongs

Parameters:
  `buildFile` - Ant build file
Throws:
  `MalformedURLException` - if parent URL cannot be constructed
Since:
  Ant 1.8.0

### getBuildFile

public File getBuildFile()
find out the build file

Returns:
  the build file to which the XML context belongs

### getBuildFileParent

public File getBuildFileParent()
find out the parent build file of this build file

Returns:
  the parent build file of this build file

### getBuildFileURL

public URL getBuildFileURL()
find out the build file

Returns:
  the build file to which the xml context belongs
Since:
  Ant 1.8.0

### getBuildFileParentURL

public URL getBuildFileParentURL()
find out the parent build file of this build file

Returns:
  the parent build file of this build file
Since:
  Ant 1.8.0

### getProject

public Project getProject()
find out the project to which this antxml context belongs

Returns:
  project

### getCurrentProjectName

public String getCurrentProjectName()
find out the current project name

Returns:
  current project name

### setCurrentProjectName

public void setCurrentProjectName(String name)
set the name of the current project

Parameters:
  `name` - name of the current project

### currentWrapper

public RuntimeConfigurable currentWrapper()
get the current runtime configurable wrapper can return null

Returns:
  runtime configurable wrapper

### parentWrapper

public RuntimeConfigurable parentWrapper()
get the runtime configurable wrapper of the parent project can return null

Returns:
  runtime configurable wrapper of the parent project

### pushWrapper

public void pushWrapper(RuntimeConfigurable wrapper)
add a runtime configurable wrapper to the internal stack

Parameters:
  `wrapper` - runtime configurable wrapper

### popWrapper

public void popWrapper()
remove a runtime configurable wrapper from the stack

### getWrapperStack

public Vector<RuntimeConfigurable> getWrapperStack()
access the stack of wrappers

Returns:
  the stack of wrappers

### addTarget

public void addTarget(Target target)
add a new target

Parameters:
  `target` - target to add

### getCurrentTarget

public Target getCurrentTarget()
get the current target

Returns:
  current target

### getImplicitTarget

public Target getImplicitTarget()
get the implicit target

Returns:
  implicit target

### setCurrentTarget

public void setCurrentTarget(Target target)
sets the current target

Parameters:
  `target` - current target

### setImplicitTarget

public void setImplicitTarget(Target target)
sets the implicit target

Parameters:
  `target` - the implicit target

### getTargets

public Vector<Target> getTargets()
access the vector of targets

Returns:
  vector of targets

### configureId

public void configureId(Object element, Attributes attr)
Scans an attribute list for the `id` attribute and stores a reference to the target object in the project if an id is found.

This method was moved out of the configure method to allow it to be executed at parse time.

Parameters:
  `element` - the current element
  `attr` - attributes of the current element

### getLocator

public Locator getLocator()
access the locator

Returns:
  locator

### setLocator

public void setLocator(Locator locator)
sets the locator

Parameters:
  `locator` - locator

### isIgnoringProjectTag

public boolean isIgnoringProjectTag()
tells whether the project tag is being ignored

Returns:
  whether the project tag is being ignored

### setIgnoreProjectTag

public void setIgnoreProjectTag(boolean flag)
sets the flag to ignore the project tag

Parameters:
  `flag` - to ignore the project tag

### startPrefixMapping

public void startPrefixMapping(String prefix, String uri)
Called during parsing, stores the prefix to uri mapping.

Parameters:
  `prefix` - a namespace prefix
  `uri` - a namespace uri

### endPrefixMapping

public void endPrefixMapping(String prefix)
End of prefix to uri mapping.

Parameters:
  `prefix` - the namespace prefix

### getPrefixMapping

public String getPrefixMapping(String prefix)
prefix to namespace uri mapping

Parameters:
  `prefix` - the prefix to map
Returns:
  the uri for this prefix, null if not present

### getCurrentTargets

public Map<String,Target> getCurrentTargets()
Get the targets in the current source file.

Returns:
  the current targets.

### setCurrentTargets

public void setCurrentTargets(Map<String,Target> currentTargets)
Set the map of the targets in the current source file.

Parameters:
  `currentTargets` - a map of targets.