Class SaxWalkerOverDom
java.lang.Object
org.apache.ws.commons.schema.docpath.SaxWalkerOverDom
Walks over a
Document in a SAX style, notifying listeners with SAX
events.
Because the document has already been processed, only the following methods
in the ContentHandler will be called:
ContentHandler.startDocument()ContentHandler.startPrefixMapping(String, String)ContentHandler.startElement(String, String, String, Attributes)ContentHandler.characters(char[], int, int)ContentHandler.endElement(String, String, String)ContentHandler.endPrefixMapping(String)ContentHandler.endDocument()
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newSaxWalkerOverDom.SaxWalkerOverDom(List<ContentHandler> contentHandlers) Constructs a newSaxWalkerOverDom, taking ownership of the list ofContentHandlers to send events to.SaxWalkerOverDom(ContentHandler contentHandler) Constructs a newSaxWalkerOverDomwith the providedContentHandlerto send SAX events. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContentHandler(ContentHandler contentHandler) Adds the providedContentHandlerto the list of content handlers to send events to.private static StringconvertNullToEmptyString(String input) booleanremoveContentHandler(ContentHandler contentHandler) Removes the first instance of the providedContentHandlerfrom the set of handlers to send events to.startPrefixMappings(Node node) voidWalks the providedDocument, sending events to all of theContentHandlers as it traverses.private voidprivate void
-
Field Details
-
listeners
-
-
Constructor Details
-
SaxWalkerOverDom
public SaxWalkerOverDom()Constructs a newSaxWalkerOverDom. -
SaxWalkerOverDom
Constructs a newSaxWalkerOverDomwith the providedContentHandlerto send SAX events.- Parameters:
contentHandler- The content handler to send events to.
-
SaxWalkerOverDom
Constructs a newSaxWalkerOverDom, taking ownership of the list ofContentHandlers to send events to.- Parameters:
contentHandlers- The list of content handlers to send events to.
-
-
Method Details
-
addContentHandler
Adds the providedContentHandlerto the list of content handlers to send events to. If this content handler was already added, it will be sent events twice (or more often).- Parameters:
contentHandler- The content handler to send events to.
-
removeContentHandler
Removes the first instance of the providedContentHandlerfrom the set of handlers to send events to. If the content handler was added more than once, it will continue to receive events.- Parameters:
contentHandler- The content handler to stop sending events to.- Returns:
trueif it was found,falseif not.
-
walk
Walks the providedDocument, sending events to all of theContentHandlers as it traverses. If there are no content handlers, this method is a no-op.- Parameters:
document- TheDocumentto traverse.- Throws:
SAXException- if an exception occurs when notifying the handlers.
-
walk
- Throws:
SAXException
-
walk
- Throws:
SAXException
-
convertNullToEmptyString
-
startPrefixMappings
- Throws:
DOMExceptionSAXException
-