Package org.apache.tools.ant.helper
Class ProjectHelper2.ElementHandler
java.lang.Object
org.apache.tools.ant.helper.ProjectHelper2.AntHandler
org.apache.tools.ant.helper.ProjectHelper2.ElementHandler
- Enclosing class:
- ProjectHelper2
public static class ProjectHelper2.ElementHandler extends ProjectHelper2.AntHandler
Handler for all project elements (tasks, data types)
-
Constructor Summary
Constructors Constructor Description ElementHandler()
Constructor. -
Method Summary
Modifier and Type Method Description void
characters(char[] buf, int start, int count, AntXMLContext context)
Adds text to the task, using the wrappervoid
onEndElement(java.lang.String uri, java.lang.String tag, AntXMLContext context)
Handles the end of the element.ProjectHelper2.AntHandler
onStartChild(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, AntXMLContext context)
Handles the start of an element within a target.void
onStartElement(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, AntXMLContext context)
Initialisation routine called after handler creation with the element name and attributes.Methods inherited from class org.apache.tools.ant.helper.ProjectHelper2.AntHandler
checkNamespace, onEndChild
-
Constructor Details
-
ElementHandler
public ElementHandler()Constructor.
-
-
Method Details
-
onStartElement
public void onStartElement(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, AntXMLContext context) throws org.xml.sax.SAXParseExceptionInitialisation routine called after handler creation with the element name and attributes. This configures the element with its attributes and sets it up with its parent container (if any). Nested elements are then added later as the parser encounters them.- Overrides:
onStartElement
in classProjectHelper2.AntHandler
- Parameters:
uri
- The namespace URI for this element.tag
- Name of the element which caused this handler to be created. Must not benull
.qname
- The qualified name for this element.attrs
- Attributes of the element which caused this handler to be created. Must not benull
.context
- The current context.- Throws:
org.xml.sax.SAXParseException
- in case of error (not thrown in this implementation)
-
characters
public void characters(char[] buf, int start, int count, AntXMLContext context) throws org.xml.sax.SAXParseExceptionAdds text to the task, using the wrapper- Overrides:
characters
in classProjectHelper2.AntHandler
- Parameters:
buf
- A character array of the text within the element. Will not benull
.start
- The start element in the array.count
- The number of characters to read from the array.context
- The current context.- Throws:
org.xml.sax.SAXParseException
- if the element doesn't support text- See Also:
ProjectHelper.addText(Project,java.lang.Object,char[],int,int)
-
onStartChild
public ProjectHelper2.AntHandler onStartChild(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, AntXMLContext context) throws org.xml.sax.SAXParseExceptionHandles the start of an element within a target. Task containers will always use another task handler, and all other tasks will always use a nested element handler.- Overrides:
onStartChild
in classProjectHelper2.AntHandler
- Parameters:
uri
- The namespace URI for this element.tag
- The name of the element being started. Will not benull
.qname
- The qualified name for this element.attrs
- Attributes of the element being started. Will not benull
.context
- The current context.- Returns:
- The handler for elements.
- Throws:
org.xml.sax.SAXParseException
- if an error occurs when initialising the appropriate child handler
-
onEndElement
Handles the end of the element. This pops the wrapper from the context.- Overrides:
onEndElement
in classProjectHelper2.AntHandler
- Parameters:
uri
- The namespace URI for the element.tag
- The name of the element.context
- The current context.
-