org.apache.ws.commons.schema.docpath
Class SaxWalkerOverDom

java.lang.Object
  extended by org.apache.ws.commons.schema.docpath.SaxWalkerOverDom

public final class SaxWalkerOverDom
extends Object

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:


Constructor Summary
SaxWalkerOverDom()
          Constructs a new SaxWalkerOverDom.
SaxWalkerOverDom(ContentHandler contentHandler)
          Constructs a new SaxWalkerOverDom with the provided ContentHandler to send SAX events.
SaxWalkerOverDom(List<ContentHandler> contentHandlers)
          Constructs a new SaxWalkerOverDom, taking ownership of the list of ContentHandlers to send events to.
 
Method Summary
 void addContentHandler(ContentHandler contentHandler)
          Adds the provided ContentHandler to the list of content handlers to send events to.
 boolean removeContentHandler(ContentHandler contentHandler)
          Removes the first instance of the provided ContentHandler from the set of handlers to send events to.
 void walk(Document document)
          Walks the provided Document, sending events to all of the ContentHandlers as it traverses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaxWalkerOverDom

public SaxWalkerOverDom()
Constructs a new SaxWalkerOverDom.


SaxWalkerOverDom

public SaxWalkerOverDom(ContentHandler contentHandler)
Constructs a new SaxWalkerOverDom with the provided ContentHandler to send SAX events.

Parameters:
contentHandler - The content handler to send events to.

SaxWalkerOverDom

public SaxWalkerOverDom(List<ContentHandler> contentHandlers)
Constructs a new SaxWalkerOverDom, taking ownership of the list of ContentHandlers to send events to.

Parameters:
contentHandlers - The list of content handlers to send events to.
Method Detail

addContentHandler

public void addContentHandler(ContentHandler contentHandler)
Adds the provided ContentHandler to 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

public boolean removeContentHandler(ContentHandler contentHandler)
Removes the first instance of the provided ContentHandler from 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:
true if it was found, false if not.

walk

public void walk(Document document)
          throws SAXException
Walks the provided Document, sending events to all of the ContentHandlers as it traverses. If there are no content handlers, this method is a no-op.

Parameters:
document - The Document to traverse.
systemId - The system ID of this Document.
Throws:
SAXException - if an exception occurs when notifying the handlers.


Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.