Package org.apache.tools.ant.helper
Class ProjectHelper2.RootHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.tools.ant.helper.ProjectHelper2.RootHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Enclosing class:
- ProjectHelper2
Handler for ant processing. Uses a stack of AntHandlers to
implement each element (the original parser used a recursive behavior,
with the implicit execution stack)
-
Constructor Summary
ConstructorDescriptionRootHandler
(AntXMLContext context, ProjectHelper2.AntHandler rootHandler) Creates a new RootHandler instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] buf, int start, int count) Handle text within an element, calls currentHandler.characters.void
endElement
(String uri, String name, String qName) Handles the end of an element.void
endPrefixMapping
(String prefix) End a namespace prefix to uri mappingReturns the current ant handler object.resolveEntity
(String publicId, String systemId) Resolves file: URIs relative to the build file.void
setDocumentLocator
(Locator locator) Sets the locator in the project helper for future reference.void
startElement
(String uri, String tag, String qname, Attributes attrs) Handles the start of a project element.void
startPrefixMapping
(String prefix, String uri) Start a namespace prefix to uri mappingMethods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startDocument, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
RootHandler
Creates a new RootHandler instance.- Parameters:
context
- The context for the handler.rootHandler
- The handler for the root element.
-
-
Method Details
-
getCurrentAntHandler
Returns the current ant handler object.- Returns:
- the current ant handler.
-
resolveEntity
Resolves file: URIs relative to the build file.- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
- Parameters:
publicId
- The public identifier, ornull
if none is available. Ignored in this implementation.systemId
- The system identifier provided in the XML document. Will not benull
.- Returns:
- an inputsource for this identifier
-
startElement
public void startElement(String uri, String tag, String qname, Attributes attrs) throws SAXParseException Handles the start of a project element. A project handler is created and initialised with the element name and attributes.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- 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
.- Throws:
SAXParseException
- if the tag given is not"project"
-
setDocumentLocator
Sets the locator in the project helper for future reference.- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classDefaultHandler
- Parameters:
locator
- The locator used by the parser. Will not benull
.
-
endElement
Handles the end of an element. Any required clean-up is performed by the onEndElement() method and then the original handler is restored to the parser.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Parameters:
uri
- The namespace URI for this element.name
- The name of the element which is ending. Will not benull
.qName
- The qualified name for this element.- Throws:
SAXException
- in case of error (not thrown in this implementation)
-
characters
Handle text within an element, calls currentHandler.characters.- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Parameters:
buf
- A character array of the test.start
- The start offset in the array.count
- The number of characters to read.- Throws:
SAXParseException
- if an error occurs
-
startPrefixMapping
Start a namespace prefix to uri mapping- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classDefaultHandler
- Parameters:
prefix
- the namespace prefixuri
- the namespace uri
-
endPrefixMapping
End a namespace prefix to uri mapping- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classDefaultHandler
- Parameters:
prefix
- the prefix that is not mapped anymore
-