org.cyberneko.html.filters
Class Identity

java.lang.Object
  extended byorg.cyberneko.html.filters.DefaultFilter
      extended byorg.cyberneko.html.filters.Identity
All Implemented Interfaces:
HTMLComponent, XMLComponent, XMLDocumentFilter, XMLDocumentHandler, XMLDocumentSource

public class Identity
extends DefaultFilter

This filter performs the identity operation of the original document event stream generated by the HTML scanner by removing events that are synthesized by the tag balancer. This operation is essentially the same as turning off tag-balancing in the parser. However, this filter is useful when you want the tag balancer to report "errors" but do not want the synthesized events in the output.

Note: This filter requires the augmentations feature to be turned on. For example:

  XMLParserConfiguration parser = new HTMLConfiguration();
  parser.setFeature("http://cyberneko.org/html/features/augmentations", true);
 

Note: This isn't exactly the identify transform because the element and attributes names may have been modified from the original document. For example, by default, NekoHTML converts element names to upper-case and attribute names to lower-case.

Version:
$Id$
Author:
Andy Clark

Field Summary
protected static String AUGMENTATIONS
          Augmentations feature identifier.
protected static String FILTERS
          Filters property identifier.
 
Fields inherited from class org.cyberneko.html.filters.DefaultFilter
fDocumentHandler, fDocumentSource
 
Constructor Summary
Identity()
           
 
Method Summary
 void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
          Empty element.
 void endElement(QName element, Augmentations augs)
          End element.
 void startElement(QName element, XMLAttributes attributes, Augmentations augs)
          Start element.
protected static boolean synthesized(Augmentations augs)
          Returns true if the information provided is synthesized.
 
Methods inherited from class org.cyberneko.html.filters.DefaultFilter
characters, comment, doctypeDecl, endCDATA, endDocument, endGeneralEntity, endPrefixMapping, getDocumentHandler, getDocumentSource, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, ignorableWhitespace, merge, processingInstruction, reset, setDocumentHandler, setDocumentSource, setFeature, setProperty, startCDATA, startDocument, startDocument, startGeneralEntity, startPrefixMapping, textDecl, xmlDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUGMENTATIONS

protected static final String AUGMENTATIONS
Augmentations feature identifier.

See Also:
Constant Field Values

FILTERS

protected static final String FILTERS
Filters property identifier.

See Also:
Constant Field Values
Constructor Detail

Identity

public Identity()
Method Detail

startElement

public void startElement(QName element,
                         XMLAttributes attributes,
                         Augmentations augs)
                  throws XNIException
Start element.

Specified by:
startElement in interface XMLDocumentHandler
Overrides:
startElement in class DefaultFilter
Throws:
XNIException

emptyElement

public void emptyElement(QName element,
                         XMLAttributes attributes,
                         Augmentations augs)
                  throws XNIException
Empty element.

Specified by:
emptyElement in interface XMLDocumentHandler
Overrides:
emptyElement in class DefaultFilter
Throws:
XNIException

endElement

public void endElement(QName element,
                       Augmentations augs)
                throws XNIException
End element.

Specified by:
endElement in interface XMLDocumentHandler
Overrides:
endElement in class DefaultFilter
Throws:
XNIException

synthesized

protected static boolean synthesized(Augmentations augs)
Returns true if the information provided is synthesized.



(C) Copyright 2002-2004, Andy Clark. All rights reserved.