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)protectedDelegatorHandler(LinkedList<String> elementStack, boolean strict)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendCharacterBuffer(char[] ch, int start, int length)protected voidappendCharacterBuffer(String str)voidcharacters(char[] ch, int start, int length)protected StringcurrentElement()protected StringcurrentElementParent()voidendElement(String uri, String localName, String qName)voiderror(SAXParseException e)voidfatalError(SAXParseException e)protected StringgetAndResetCharacterBuffer()UnknownFormatExceptiongetException()AbstractSiteMapgetSiteMap()protected URLgetUrl()protected booleanisAcceptedNamespace(String uri)static booleanisAllBlank(CharSequence charSeq)Return true if character sequence contains only white space including Unicode whitespace, cf.protected booleanisExtensionNamespace(String uri)protected booleanisStrict()protected booleanisStrictNamespace()static booleanisWhitespace(char c)Check whether character is any Unicode whitespace, including the space characters not covered byCharacter.isWhitespace(char)protected voidresetCharacterBuffer()voidsetAcceptedNamespaces(Set<String> acceptedSet)protected voidsetException(UnknownFormatException exception)voidsetExtensionNamespaces(Map<String,Extension> extensionMap)voidsetStrictNamespace(boolean s)voidsetURLFilter(Function<String,String> urlFilter)voidstartElement(String uri, String localName, String qName, Attributes attributes)static StringstripAllBlank(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:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin 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:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
fatalError
public void fatalError(SAXParseException e) throws SAXException
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin 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
-
-