Package org.apache.ivy.osgi.util
Class DelegatingHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.ivy.osgi.util.DelegatingHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class DelegatingHandler
extends DefaultHandler
implements DTDHandler, ContentHandler, ErrorHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <DH extends DelegatingHandler>
voidaddChild
(DH saxHandler, DelegatingHandler.ChildElementHandler<DH> elementHandler) final void
characters
(char[] ch, int start, int length) protected void
doCharacters
(char[] ch, int start, int length) protected void
By default do nothing.protected void
doEndElement
(String uri, String localName, String name) By default do nothing.protected void
doEndPrefixMapping
(String prefix) By default do nothing.protected void
doError
(SAXParseException exception) By default do nothing.protected void
doFatalError
(SAXParseException exception) By default do nothing.protected void
doIgnorableWhitespace
(char[] ch, int start, int length) By default do nothingprotected void
doNotationDecl
(String name, String publicId, String systemId) By default do nothing.protected void
doProcessingInstruction
(String target, String data) By default do nothingprotected void
doSkippedEntity
(String name) By default do nothing.protected void
By default do nothing.protected void
doStartElement
(String uri, String localName, String name, Attributes atts) By default do nothing.protected void
doStartPrefixMapping
(String prefix, String uri) By default do nothing.protected void
doUnparsedEntityDecl
(String name, String publicId, String systemId, String notationName) By default do nothing.protected void
doWarning
(SAXParseException exception) By default do nothing.final void
final void
endElement
(String uri, String localName, String n) final void
endPrefixMapping
(String prefix) final void
error
(SAXParseException exception) final void
fatalError
(SAXParseException exception) protected String
Return an sort of identifier of the current element being parsed.protected static String
getLocation
(Locator locator) getName()
protected String
getOptionalAttribute
(Attributes atts, String name, String defaultValue) protected Boolean
getOptionalBooleanAttribute
(Attributes atts, String name, Boolean defaultValue) protected Integer
getOptionalIntAttribute
(Attributes atts, String name, Integer defaultValue) protected Long
getOptionalLongAttribute
(Attributes atts, String name, Long defaultValue) protected String
getRequiredAttribute
(Attributes atts, String name) protected boolean
getRequiredBooleanAttribute
(Attributes atts, String name) protected int
getRequiredIntAttribute
(Attributes atts, String name, Integer logLevel) protected long
getRequiredLongAttribute
(Attributes atts, String name) protected void
handleAttributes
(Attributes atts) Called when the expected node is achieved; nothing to do by default.final void
ignorableWhitespace
(char[] ch, int start, int length) boolean
protected void
protected void
final void
notationDecl
(String name, String publicId, String systemId) final void
processingInstruction
(String target, String data) void
setBufferingChar
(boolean bufferingChar) void
setDocumentLocator
(Locator locator) void
setSkipOnError
(boolean skipOnError) void
skip()
final void
skippedEntity
(String name) final void
final void
startElement
(String uri, String localName, String n, Attributes atts) final void
startPrefixMapping
(String prefix, String uri) protected void
final void
unparsedEntityDecl
(String name, String publicId, String systemId, String notationName) final void
warning
(SAXParseException exception) Methods inherited from class org.xml.sax.helpers.DefaultHandler
resolveEntity
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
-
DelegatingHandler
-
-
Method Details
-
addChild
protected <DH extends DelegatingHandler> void addChild(DH saxHandler, DelegatingHandler.ChildElementHandler<DH> elementHandler) -
getName
-
getParent
-
setBufferingChar
public void setBufferingChar(boolean bufferingChar) -
setSkipOnError
public void setSkipOnError(boolean skipOnError) -
isBufferingChar
public boolean isBufferingChar() -
getBufferedChars
-
setDocumentLocator
- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classDefaultHandler
-
getLocator
-
getCurrentElementIdentifier
Return an sort of identifier of the current element being parsed. It will only be used for logging purpose.- Returns:
- an empty string by default
-
skip
public void skip() -
stopDelegating
protected void stopDelegating() -
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classDefaultHandler
- Throws:
SAXException
-
doStartDocument
By default do nothing.- Throws:
SAXException
- API told me so
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classDefaultHandler
- Throws:
SAXException
-
doEndDocument
By default do nothing.- Throws:
SAXException
- API told me so
-
startElement
public final void startElement(String uri, String localName, String n, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
handleAttributes
Called when the expected node is achieved; nothing to do by default.- Parameters:
atts
- the xml attributes attached to the expected node- Throws:
SAXException
- in case the parsing should be completely stopped
-
doStartElement
protected void doStartElement(String uri, String localName, String name, Attributes atts) throws SAXException By default do nothing.- Parameters:
uri
- StringlocalName
- Stringname
- Stringatts
- Attributes- Throws:
SAXException
- API told me so
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
doEndElement
By default do nothing.- Parameters:
uri
- StringlocalName
- Stringname
- String- Throws:
SAXException
- API told me so
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
doCharacters
- Parameters:
ch
- char[]start
- intlength
- int- Throws:
SAXException
- if something goes wrong
-
startPrefixMapping
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classDefaultHandler
- Throws:
SAXException
-
doStartPrefixMapping
By default do nothing.- Parameters:
prefix
- Stringuri
- String- Throws:
SAXException
- API told me so
-
endPrefixMapping
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classDefaultHandler
- Throws:
SAXException
-
doEndPrefixMapping
By default do nothing.- Parameters:
prefix
- String- Throws:
SAXException
- API told me so
-
ignorableWhitespace
- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Overrides:
ignorableWhitespace
in classDefaultHandler
- Throws:
SAXException
-
doIgnorableWhitespace
By default do nothing- Parameters:
ch
- char[]start
- intlength
- int- Throws:
SAXException
- API told me so
-
notationDecl
- Specified by:
notationDecl
in interfaceDTDHandler
- Overrides:
notationDecl
in classDefaultHandler
- Throws:
SAXException
-
doNotationDecl
By default do nothing.- Parameters:
name
- StringpublicId
- StringsystemId
- String- Throws:
SAXException
- API told me so
-
processingInstruction
- Specified by:
processingInstruction
in interfaceContentHandler
- Overrides:
processingInstruction
in classDefaultHandler
- Throws:
SAXException
-
doProcessingInstruction
By default do nothing- Parameters:
target
- Stringdata
- String- Throws:
SAXException
- API told me so
-
skippedEntity
- Specified by:
skippedEntity
in interfaceContentHandler
- Overrides:
skippedEntity
in classDefaultHandler
- Throws:
SAXException
-
doSkippedEntity
By default do nothing.- Parameters:
name
- String- Throws:
SAXException
- API told me so
-
unparsedEntityDecl
public final void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException - Specified by:
unparsedEntityDecl
in interfaceDTDHandler
- Overrides:
unparsedEntityDecl
in classDefaultHandler
- Throws:
SAXException
-
doUnparsedEntityDecl
protected void doUnparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException By default do nothing.- Parameters:
name
- StringpublicId
- StringsystemId
- StringnotationName
- String- Throws:
SAXException
- API told me so
-
warning
- Specified by:
warning
in interfaceErrorHandler
- Overrides:
warning
in classDefaultHandler
- Throws:
SAXException
-
doWarning
By default do nothing.- Parameters:
exception
- SAXParseException- Throws:
SAXException
- API told me so
-
error
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
doError
By default do nothing.- Parameters:
exception
- SAXParseException- Throws:
SAXException
- API told me so
-
fatalError
- Specified by:
fatalError
in interfaceErrorHandler
- Overrides:
fatalError
in classDefaultHandler
- Throws:
SAXException
-
doFatalError
By default do nothing.- Parameters:
exception
- SAXParseException- Throws:
SAXException
- API told me so
-
log
-
log
-
getLocation
-
getRequiredAttribute
- Throws:
SAXParseException
-
getOptionalAttribute
-
getRequiredIntAttribute
protected int getRequiredIntAttribute(Attributes atts, String name, Integer logLevel) throws SAXParseException - Throws:
SAXParseException
-
getOptionalIntAttribute
protected Integer getOptionalIntAttribute(Attributes atts, String name, Integer defaultValue) throws SAXParseException - Throws:
SAXParseException
-
getRequiredLongAttribute
- Throws:
SAXParseException
-
getOptionalLongAttribute
protected Long getOptionalLongAttribute(Attributes atts, String name, Long defaultValue) throws SAXParseException - Throws:
SAXParseException
-
getRequiredBooleanAttribute
protected boolean getRequiredBooleanAttribute(Attributes atts, String name) throws SAXParseException - Throws:
SAXParseException
-
getOptionalBooleanAttribute
protected Boolean getOptionalBooleanAttribute(Attributes atts, String name, Boolean defaultValue) throws SAXParseException - Throws:
SAXParseException
-