Package crawlercommons.sitemaps.sax
Class DelegatorHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- crawlercommons.sitemaps.sax.DelegatorHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class DelegatorHandler extends DefaultHandler
Provides a base SAX handler for parsing of XML documents representing sub-classes of AbstractSiteMap.
-
-
Constructor Summary
Constructors Modifier Constructor Description DelegatorHandler(URL url, boolean strict)
protected
DelegatorHandler(LinkedList<String> elementStack, boolean strict)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendCharacterBuffer(char[] ch, int start, int length)
protected void
appendCharacterBuffer(String str)
void
characters(char[] ch, int start, int length)
protected String
currentElement()
protected String
currentElementParent()
void
endElement(String uri, String localName, String qName)
void
error(SAXParseException e)
void
fatalError(SAXParseException e)
protected String
getAndResetCharacterBuffer()
UnknownFormatException
getException()
AbstractSiteMap
getSiteMap()
protected URL
getUrl()
protected boolean
isAcceptedNamespace(String uri)
static boolean
isAllBlank(CharSequence charSeq)
Return true if character sequence contains only white space including Unicode whitespace, cf.protected boolean
isExtensionNamespace(String uri)
protected boolean
isStrict()
protected boolean
isStrictNamespace()
static boolean
isWhitespace(char c)
Check whether character is any Unicode whitespace, including the space characters not covered byCharacter.isWhitespace(char)
protected void
resetCharacterBuffer()
void
setAcceptedNamespaces(Set<String> acceptedSet)
protected void
setException(UnknownFormatException exception)
void
setExtensionNamespaces(Map<String,Extension> extensionMap)
void
setStrictNamespace(boolean s)
void
setURLFilter(Function<String,String> urlFilter)
void
startElement(String uri, String localName, String qName, Attributes attributes)
static String
stripAllBlank(CharSequence charSeq)
Trim all whitespace including Unicode whitespace-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
DelegatorHandler
protected DelegatorHandler(LinkedList<String> elementStack, boolean strict)
-
DelegatorHandler
public DelegatorHandler(URL url, boolean strict)
-
-
Method Detail
-
getUrl
protected URL getUrl()
-
isStrict
protected boolean isStrict()
-
isStrictNamespace
protected boolean isStrictNamespace()
-
setStrictNamespace
public void setStrictNamespace(boolean s)
-
isAcceptedNamespace
protected boolean isAcceptedNamespace(String uri)
-
isExtensionNamespace
protected boolean isExtensionNamespace(String uri)
-
setException
protected void setException(UnknownFormatException exception)
-
getException
public UnknownFormatException getException()
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
appendCharacterBuffer
protected void appendCharacterBuffer(char[] ch, int start, int length)
-
appendCharacterBuffer
protected void appendCharacterBuffer(String str)
-
getAndResetCharacterBuffer
protected String getAndResetCharacterBuffer()
-
resetCharacterBuffer
protected void resetCharacterBuffer()
-
currentElement
protected String currentElement()
-
currentElementParent
protected String currentElementParent()
-
getSiteMap
public AbstractSiteMap getSiteMap()
-
error
public void error(SAXParseException e) throws SAXException
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
fatalError
public void fatalError(SAXParseException e) throws SAXException
- Specified by:
fatalError
in interfaceErrorHandler
- Overrides:
fatalError
in classDefaultHandler
- Throws:
SAXException
-
isAllBlank
public static boolean isAllBlank(CharSequence charSeq)
Return true if character sequence contains only white space including Unicode whitespace, cf.isWhitespace(char)
-
isWhitespace
public static boolean isWhitespace(char c)
Check whether character is any Unicode whitespace, including the space characters not covered byCharacter.isWhitespace(char)
-
stripAllBlank
public static String stripAllBlank(CharSequence charSeq)
Trim all whitespace including Unicode whitespace
-
-