Top Description Fields Constructors Methods
com.sun.tools.xjc.util

public abstract Class SubtreeCutter

extends XMLFilterImpl
Class Inheritance
Known Direct Subclasses
com.sun.tools.xjc.reader.AbstractExtensionBindingChecker
Imports
org.xml.sax.helpers.XMLFilterImpl, .DefaultHandler, org.xml.sax.XMLFilter, .ContentHandler, .SAXException, .Attributes

XMLFilter that can cut sub-trees.
Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private int
cutDepth

When we are pruning a sub tree, this field holds the depth of elements that are being cut.

private ContentHandler
next

This field remembers the user-specified ContentHandler.

private static final ContentHandler
stub

This object will receive SAX events while a sub tree is being pruned.

Constructor Summary

AccessConstructor and Description
protected
SubtreeCutter()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
endElement(String namespaceURI, String localName, String qName)

Overrides org.xml.sax.helpers.XMLFilterImpl.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Filter an end element event.

public boolean
public void
public void
startCutting()

Starts cutting a sub-tree.

public void
public void
startElement(String uri, String localName, String qName, Attributes atts)

Overrides org.xml.sax.helpers.XMLFilterImpl.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Filter a start element event.

Inherited from org.xml.sax.helpers.XMLFilterImpl:
charactersendDocumentendPrefixMappingerrorfatalErrorgetContentHandlergetDTDHandlergetEntityResolvergetErrorHandlergetFeaturegetParentgetPropertyignorableWhitespacenotationDeclparseparseprocessingInstructionresolveEntitysetDocumentLocatorsetDTDHandlersetEntityResolversetErrorHandlersetFeaturesetParentsetPropertyskippedEntitystartPrefixMappingunparsedEntityDeclwarning

Field Detail

cutDepthback to summary
private int cutDepth

When we are pruning a sub tree, this field holds the depth of elements that are being cut. Used to resume event forwarding. As long as this value is 0, we will pass through data.

nextback to summary
private ContentHandler next

This field remembers the user-specified ContentHandler. So that we can restore it once the sub tree is completely pruned.

stubback to summary
private static final ContentHandler stub

This object will receive SAX events while a sub tree is being pruned.

Constructor Detail

SubtreeCutterback to summary
protected SubtreeCutter()

Default constructor.

Method Detail

endElementback to summary
public void endElement(String namespaceURI, String localName, String qName) throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.helpers.XMLFilterImpl.endElement.

Filter an end element event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.
isCuttingback to summary
public boolean isCutting()
setContentHandlerback to summary
public void setContentHandler(ContentHandler handler)

Overrides org.xml.sax.helpers.XMLFilterImpl.setContentHandler.

Implements org.xml.sax.XMLReader.setContentHandler.

Doc from org.xml.sax.helpers.XMLFilterImpl.setContentHandler.

Set the content event handler.

Annotations
@Override
startCuttingback to summary
public void startCutting()

Starts cutting a sub-tree. Should be called from within the startElement(String, String, String, Attributes) implementation before the execution is passed to SubtreeCutter#startElement(String, String, String, Attributes) . The current element will be cut.

startDocumentback to summary
public void startDocument() throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.startDocument.

Implements org.xml.sax.ContentHandler.startDocument.

Doc from org.xml.sax.helpers.XMLFilterImpl.startDocument.

Filter a start document event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.
startElementback to summary
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.XMLFilterImpl.startElement.

Filter a start element event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.