# DelegatorHandler (Crawler-commons 1.3 API)

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.

### Field Summary

Fields
`protected Map<String,​Extension>` `extensionNamespaces`
`protected Function<String,​String>` `urlFilter`

### Constructor Summary

Constructors
`` `DelegatorHandler​(URL url, boolean strict)`
`protected` `DelegatorHandler​(LinkedList<String> elementStack, boolean strict)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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 by `Character.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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### extensionNamespaces

    protected Map<String,​Extension> extensionNamespaces

#### urlFilter

    protected Function<String,​String> urlFilter

### 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)

#### setAcceptedNamespaces

    public void setAcceptedNamespaces​(Set<String> acceptedSet)

#### isAcceptedNamespace

    protected boolean isAcceptedNamespace​(String uri)

#### setExtensionNamespaces

    public void setExtensionNamespaces​(Map<String,​Extension> extensionMap)

#### isExtensionNamespace

    protected boolean isExtensionNamespace​(String uri)

#### setURLFilter

    public void setURLFilter​(Function<String,​String> urlFilter)

#### 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 interface `ContentHandler`
Overrides:
  `startElement` in class `DefaultHandler`
Throws:
  `SAXException`

#### endElement

    public void endElement​(String uri,
                           String localName,
                           String qName)
                    throws SAXException

Specified by:
  `endElement` in interface `ContentHandler`
Overrides:
  `endElement` in class `DefaultHandler`
Throws:
  `SAXException`

#### characters

    public void characters​(char[] ch,
                           int start,
                           int length)
                    throws SAXException

Specified by:
  `characters` in interface `ContentHandler`
Overrides:
  `characters` in class `DefaultHandler`
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 interface `ErrorHandler`
Overrides:
  `error` in class `DefaultHandler`
Throws:
  `SAXException`

#### fatalError

    public void fatalError​(SAXParseException e)
                    throws SAXException

Specified by:
  `fatalError` in interface `ErrorHandler`
Overrides:
  `fatalError` in class `DefaultHandler`
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 by `Character.isWhitespace(char)`

#### stripAllBlank

    public static String stripAllBlank​(CharSequence charSeq)

Trim all whitespace including Unicode whitespace