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 voidcharacters(char[] ch, int start, int length) protected voiddoCharacters(char[] ch, int start, int length) protected voidBy default do nothing.protected voiddoEndElement(String uri, String localName, String name) By default do nothing.protected voiddoEndPrefixMapping(String prefix) By default do nothing.protected voiddoError(SAXParseException exception) By default do nothing.protected voiddoFatalError(SAXParseException exception) By default do nothing.protected voiddoIgnorableWhitespace(char[] ch, int start, int length) By default do nothingprotected voiddoNotationDecl(String name, String publicId, String systemId) By default do nothing.protected voiddoProcessingInstruction(String target, String data) By default do nothingprotected voiddoSkippedEntity(String name) By default do nothing.protected voidBy default do nothing.protected voiddoStartElement(String uri, String localName, String name, Attributes atts) By default do nothing.protected voiddoStartPrefixMapping(String prefix, String uri) By default do nothing.protected voiddoUnparsedEntityDecl(String name, String publicId, String systemId, String notationName) By default do nothing.protected voiddoWarning(SAXParseException exception) By default do nothing.final voidfinal voidendElement(String uri, String localName, String n) final voidendPrefixMapping(String prefix) final voiderror(SAXParseException exception) final voidfatalError(SAXParseException exception) protected StringReturn an sort of identifier of the current element being parsed.protected static StringgetLocation(Locator locator) getName()protected StringgetOptionalAttribute(Attributes atts, String name, String defaultValue) protected BooleangetOptionalBooleanAttribute(Attributes atts, String name, Boolean defaultValue) protected IntegergetOptionalIntAttribute(Attributes atts, String name, Integer defaultValue) protected LonggetOptionalLongAttribute(Attributes atts, String name, Long defaultValue) protected StringgetRequiredAttribute(Attributes atts, String name) protected booleangetRequiredBooleanAttribute(Attributes atts, String name) protected intgetRequiredIntAttribute(Attributes atts, String name, Integer logLevel) protected longgetRequiredLongAttribute(Attributes atts, String name) protected voidhandleAttributes(Attributes atts) Called when the expected node is achieved; nothing to do by default.final voidignorableWhitespace(char[] ch, int start, int length) booleanprotected voidprotected voidfinal voidnotationDecl(String name, String publicId, String systemId) final voidprocessingInstruction(String target, String data) voidsetBufferingChar(boolean bufferingChar) voidsetDocumentLocator(Locator locator) voidsetSkipOnError(boolean skipOnError) voidskip()final voidskippedEntity(String name) final voidfinal voidstartElement(String uri, String localName, String n, Attributes atts) final voidstartPrefixMapping(String prefix, String uri) protected voidfinal voidunparsedEntityDecl(String name, String publicId, String systemId, String notationName) final voidwarning(SAXParseException exception) Methods inherited from class DefaultHandler
resolveEntityMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin 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:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException
-
doStartDocument
By default do nothing.- Throws:
SAXException- API told me so
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin 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:
startElementin interfaceContentHandler- Overrides:
startElementin 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:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
doEndElement
By default do nothing.- Parameters:
uri- StringlocalName- Stringname- String- Throws:
SAXException- API told me so
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
doCharacters
- Parameters:
ch- char[]start- intlength- int- Throws:
SAXException- if something goes wrong
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler- Throws:
SAXException
-
doStartPrefixMapping
By default do nothing.- Parameters:
prefix- Stringuri- String- Throws:
SAXException- API told me so
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classDefaultHandler- Throws:
SAXException
-
doEndPrefixMapping
By default do nothing.- Parameters:
prefix- String- Throws:
SAXException- API told me so
-
ignorableWhitespace
- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler- Throws:
SAXException
-
doIgnorableWhitespace
By default do nothing- Parameters:
ch- char[]start- intlength- int- Throws:
SAXException- API told me so
-
notationDecl
- Specified by:
notationDeclin interfaceDTDHandler- Overrides:
notationDeclin classDefaultHandler- Throws:
SAXException
-
doNotationDecl
By default do nothing.- Parameters:
name- StringpublicId- StringsystemId- String- Throws:
SAXException- API told me so
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
doProcessingInstruction
By default do nothing- Parameters:
target- Stringdata- String- Throws:
SAXException- API told me so
-
skippedEntity
- Specified by:
skippedEntityin interfaceContentHandler- Overrides:
skippedEntityin 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:
unparsedEntityDeclin interfaceDTDHandler- Overrides:
unparsedEntityDeclin 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:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Throws:
SAXException
-
doWarning
By default do nothing.- Parameters:
exception- SAXParseException- Throws:
SAXException- API told me so
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
doError
By default do nothing.- Parameters:
exception- SAXParseException- Throws:
SAXException- API told me so
-
fatalError
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin 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
-