Class DefaultFilter
java.lang.Object
org.htmlunit.cyberneko.filters.DefaultFilter
- All Implemented Interfaces:
HTMLComponent, XMLComponent, XMLDocumentFilter, XMLDocumentSource, XMLDocumentHandler
- Direct Known Subclasses:
HTMLWriterFilter, NamespaceBinder
This class implements a filter that simply passes document
events to the next handler. It can be used as a base class to
simplify the development of new document filters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate XMLDocumentHandlerDocument handler.private XMLDocumentSource -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(XMLString text, Augmentations augs) Characters.voidcomment(XMLString text, Augmentations augs) Comment.voiddoctypeDecl(String root, String publicId, String systemId, Augmentations augs) Doctype declaration.voidemptyElement(QName element, XMLAttributes attributes, Augmentations augs) Empty element.voidendCDATA(Augmentations augs) End CDATA section.voidendDocument(Augmentations augs) End document.voidendElement(QName element, Augmentations augs) End element.Returns the document handler.getFeatureDefault(String featureId) Returns the default state for a feature, or null if this component does not want to report a default value for this feature.getPropertyDefault(String propertyId) Returns the default state for a property, or null if this component does not want to report a default value for this property.String[]Returns a list of feature identifiers that are recognized by this component.String[]Returns a list of property identifiers that are recognized by this component.protected static String[]Utility method for merging string arrays for recognized features and recognized properties.voidprocessingInstruction(String target, XMLString data, Augmentations augs) Processing instruction.voidreset(XMLComponentManager componentManager) Resets the component.voidsetDocumentHandler(XMLDocumentHandler handler) Sets the document handler.voidsetDocumentSource(XMLDocumentSource source) Sets the document source.voidsetFeature(String featureId, boolean state) Sets the state of a feature.voidsetProperty(String propertyId, Object value) Sets the value of a property.voidstartCDATA(Augmentations augs) Start CDATA section.voidstartDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs) Start document.voidstartElement(QName element, XMLAttributes attributes, Augmentations augs) Start element.voidxmlDecl(String version, String encoding, String standalone, Augmentations augs) XML declaration.
-
Field Details
-
documentHandler_
Document handler. -
documentSource_
-
-
Constructor Details
-
DefaultFilter
public DefaultFilter()
-
-
Method Details
-
setDocumentHandler
Sets the document handler.- Specified by:
setDocumentHandlerin interfaceXMLDocumentSource- Parameters:
handler- the new handler
-
getDocumentHandler
Returns the document handler.- Specified by:
getDocumentHandlerin interfaceXMLDocumentSource- Returns:
- the document handler
-
setDocumentSource
Sets the document source.- Specified by:
setDocumentSourcein interfaceXMLDocumentHandler- Parameters:
source- the new source
-
getDocumentSource
- Specified by:
getDocumentSourcein interfaceXMLDocumentHandler- Returns:
- the document source.
-
startDocument
public void startDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs) throws XNIException Start document.- Specified by:
startDocumentin interfaceXMLDocumentHandler- Parameters:
locator- The document locator, or null if the document location cannot be reported during the parsing of this document. However, it is strongly recommended that a locator be supplied that can at least report the system identifier of the document.encoding- The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).nscontext- The namespace context in effect at the start of this document. This object represents the current context. Implementors of this class are responsible for copying the namespace bindings from the the current context (and its parent contexts) if that information is important.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
xmlDecl
public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) throws XNIException XML declaration.- Specified by:
xmlDeclin interfaceXMLDocumentHandler- Parameters:
version- The XML version.encoding- The IANA encoding name of the document, or null if not specified.standalone- The standalone value, or null if not specified.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
doctypeDecl
public void doctypeDecl(String root, String publicId, String systemId, Augmentations augs) throws XNIException Doctype declaration.- Specified by:
doctypeDeclin interfaceXMLDocumentHandler- Parameters:
root- The name of the root element.publicId- The public identifier if an external DTD or null if the external DTD is specified using SYSTEM.systemId- The system identifier if an external DTD, null otherwise.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
comment
Comment.- Specified by:
commentin interfaceXMLDocumentHandler- Parameters:
text- The text in the comment.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by application to signal an error.
-
processingInstruction
public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException Processing instruction.- Specified by:
processingInstructionin interfaceXMLDocumentHandler- Parameters:
target- The target.data- The data or null if none specified.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
startElement
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException Start element.- Specified by:
startElementin interfaceXMLDocumentHandler- Parameters:
element- The name of the element.attributes- The element attributes.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
emptyElement
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException Empty element.- Specified by:
emptyElementin interfaceXMLDocumentHandler- Parameters:
element- The name of the element.attributes- The element attributes.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
characters
Characters.- Specified by:
charactersin interfaceXMLDocumentHandler- Parameters:
text- The content.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
startCDATA
Start CDATA section.- Specified by:
startCDATAin interfaceXMLDocumentHandler- Parameters:
augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
endCDATA
End CDATA section.- Specified by:
endCDATAin interfaceXMLDocumentHandler- Parameters:
augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
endElement
End element.- Specified by:
endElementin interfaceXMLDocumentHandler- Parameters:
element- The name of the element.augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
endDocument
End document.- Specified by:
endDocumentin interfaceXMLDocumentHandler- Parameters:
augs- Additional information that may include infoset augmentations- Throws:
XNIException- Thrown by handler to signal an error.
-
getRecognizedFeatures
Returns a list of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.- Specified by:
getRecognizedFeaturesin interfaceXMLComponent- Returns:
- an array of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.
-
getFeatureDefault
Returns the default state for a feature, or null if this component does not want to report a default value for this feature.- Specified by:
getFeatureDefaultin interfaceHTMLComponent- Specified by:
getFeatureDefaultin interfaceXMLComponent- Parameters:
featureId- The feature identifier.- Returns:
- the default state for a feature, or null if this component does not want to report a default value for this feature.
-
getRecognizedProperties
Returns a list of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.- Specified by:
getRecognizedPropertiesin interfaceXMLComponent- Returns:
- an array of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.
-
getPropertyDefault
Returns the default state for a property, or null if this component does not want to report a default value for this property.- Specified by:
getPropertyDefaultin interfaceHTMLComponent- Specified by:
getPropertyDefaultin interfaceXMLComponent- Parameters:
propertyId- The property identifier.- Returns:
- the default state for a property, or null if this component does not want to report a default value for this property
-
reset
Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.- Specified by:
resetin interfaceXMLComponent- Parameters:
componentManager- The component manager.- Throws:
XNIException- Thrown by component on initialization error.XMLConfigurationException
-
setFeature
Sets the state of a feature. This method is called by the component manager any time after reset when a feature changes state.Note: Components should silently ignore features that do not affect the operation of the component.
- Specified by:
setFeaturein interfaceXMLComponent- Parameters:
featureId- The feature identifier.state- The state of the feature.- Throws:
XMLConfigurationException- Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
-
setProperty
Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.Note: Components should silently ignore properties that do not affect the operation of the component.
- Specified by:
setPropertyin interfaceXMLComponent- Parameters:
propertyId- The property identifier.value- The value of the property.- Throws:
XMLConfigurationException- Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
-
merge
-