Package org.codelibs.nekohtml.filters
Class NamespaceBinder
- java.lang.Object
-
- org.codelibs.nekohtml.filters.DefaultFilter
-
- org.codelibs.nekohtml.filters.NamespaceBinder
-
- All Implemented Interfaces:
org.apache.xerces.xni.parser.XMLComponent,org.apache.xerces.xni.parser.XMLDocumentFilter,org.apache.xerces.xni.parser.XMLDocumentSource,org.apache.xerces.xni.XMLDocumentHandler,HTMLComponent
public class NamespaceBinder extends DefaultFilter
This filter binds namespaces if namespace processing is turned on by setting the feature "http://xml.org/sax/features/namespaces" is set totrue.This configuration recognizes the following features:
- http://xml.org/sax/features/namespaces
- Version:
- $Id: NamespaceBinder.java,v 1.8 2005/05/30 00:19:28 andyc Exp $
- Author:
- Andy Clark
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNamespaceBinder.NamespaceSupportThis namespace context object implements the old and new XNINamespaceContextinterface methods so that it can be used across all versions of Xerces2.
-
Field Summary
Fields Modifier and Type Field Description protected booleanfInsertNamespacesInsert namespaces.protected shortfNamesAttrsModify HTML attribute names.protected shortfNamesElemsModify HTML element names.protected NamespaceBinder.NamespaceSupportfNamespaceContextNamespace context.protected booleanfNamespacePrefixesNamespace prefixes.protected booleanfNamespacesNamespaces.protected java.lang.StringfNamespacesURINamespaces URI.protected booleanfOverrideNamespacesOverride namespaces.protected static java.lang.StringINSERT_NAMESPACESInsert namespace binding URIs.protected static java.lang.StringNAMES_ATTRSModify HTML attribute names: { "upper", "lower", "default" }.protected static java.lang.StringNAMES_ELEMSModify HTML element names: { "upper", "lower", "default" }.protected static shortNAMES_LOWERCASELowercase HTML names.protected static shortNAMES_NO_CHANGEDon't modify HTML names.protected static shortNAMES_UPPERCASEUppercase HTML names.protected static java.lang.StringNAMESPACESNamespaces.protected static java.lang.StringNAMESPACES_URINamespaces URI.protected static java.lang.StringOVERRIDE_NAMESPACESOverride namespace binding URI.static java.lang.StringXHTML_1_0_URIXHTML 1.0 namespace URI (http://www.w3.org/1999/xhtml).static java.lang.StringXML_URIXML namespace URI (http://www.w3.org/XML/1998/namespace).static java.lang.StringXMLNS_URIXMLNS namespace URI (http://www.w3.org/2000/xmlns/).-
Fields inherited from class org.codelibs.nekohtml.filters.DefaultFilter
fDocumentHandler, fDocumentSource
-
-
Constructor Summary
Constructors Constructor Description NamespaceBinder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbindNamespaces(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs)Binds namespaces.voidemptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs, org.apache.xerces.xni.Augmentations augs)Empty element.voidendElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)End element.java.lang.BooleangetFeatureDefault(java.lang.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.protected static shortgetNamesValue(java.lang.String value)Converts HTML names string value to constant value.java.lang.ObjectgetPropertyDefault(java.lang.String propertyId)Returns the default value for a property, or null if this component does not want to report a default value for this property.java.lang.String[]getRecognizedFeatures()Returns a list of feature identifiers that are recognized by this component.java.lang.String[]getRecognizedProperties()Returns a list of property identifiers that are recognized by this component.protected static java.lang.StringmodifyName(java.lang.String name, short mode)Modifies the given name based on the specified mode.voidreset(org.apache.xerces.xni.parser.XMLComponentManager manager)Resets the component.protected static voidsplitQName(org.apache.xerces.xni.QName qname)Splits a qualified name.voidstartDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding, org.apache.xerces.xni.NamespaceContext nscontext, org.apache.xerces.xni.Augmentations augs)Start document.voidstartElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs, org.apache.xerces.xni.Augmentations augs)Start element.-
Methods inherited from class org.codelibs.nekohtml.filters.DefaultFilter
characters, comment, doctypeDecl, endCDATA, endDocument, endGeneralEntity, endPrefixMapping, getDocumentHandler, getDocumentSource, ignorableWhitespace, merge, processingInstruction, setDocumentHandler, setDocumentSource, setFeature, setProperty, startCDATA, startDocument, startGeneralEntity, startPrefixMapping, textDecl, xmlDecl
-
-
-
-
Field Detail
-
XHTML_1_0_URI
public static final java.lang.String XHTML_1_0_URI
XHTML 1.0 namespace URI (http://www.w3.org/1999/xhtml).- See Also:
- Constant Field Values
-
XML_URI
public static final java.lang.String XML_URI
XML namespace URI (http://www.w3.org/XML/1998/namespace).- See Also:
- Constant Field Values
-
XMLNS_URI
public static final java.lang.String XMLNS_URI
XMLNS namespace URI (http://www.w3.org/2000/xmlns/).- See Also:
- Constant Field Values
-
NAMESPACES
protected static final java.lang.String NAMESPACES
Namespaces.- See Also:
- Constant Field Values
-
OVERRIDE_NAMESPACES
protected static final java.lang.String OVERRIDE_NAMESPACES
Override namespace binding URI.- See Also:
- Constant Field Values
-
INSERT_NAMESPACES
protected static final java.lang.String INSERT_NAMESPACES
Insert namespace binding URIs.- See Also:
- Constant Field Values
-
NAMES_ELEMS
protected static final java.lang.String NAMES_ELEMS
Modify HTML element names: { "upper", "lower", "default" }.- See Also:
- Constant Field Values
-
NAMES_ATTRS
protected static final java.lang.String NAMES_ATTRS
Modify HTML attribute names: { "upper", "lower", "default" }.- See Also:
- Constant Field Values
-
NAMESPACES_URI
protected static final java.lang.String NAMESPACES_URI
Namespaces URI.- See Also:
- Constant Field Values
-
NAMES_NO_CHANGE
protected static final short NAMES_NO_CHANGE
Don't modify HTML names.- See Also:
- Constant Field Values
-
NAMES_UPPERCASE
protected static final short NAMES_UPPERCASE
Uppercase HTML names.- See Also:
- Constant Field Values
-
NAMES_LOWERCASE
protected static final short NAMES_LOWERCASE
Lowercase HTML names.- See Also:
- Constant Field Values
-
fNamespaces
protected boolean fNamespaces
Namespaces.
-
fNamespacePrefixes
protected boolean fNamespacePrefixes
Namespace prefixes.
-
fOverrideNamespaces
protected boolean fOverrideNamespaces
Override namespaces.
-
fInsertNamespaces
protected boolean fInsertNamespaces
Insert namespaces.
-
fNamesElems
protected short fNamesElems
Modify HTML element names.
-
fNamesAttrs
protected short fNamesAttrs
Modify HTML attribute names.
-
fNamespacesURI
protected java.lang.String fNamespacesURI
Namespaces URI.
-
fNamespaceContext
protected final NamespaceBinder.NamespaceSupport fNamespaceContext
Namespace context.
-
-
Method Detail
-
getRecognizedFeatures
public java.lang.String[] 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 interfaceorg.apache.xerces.xni.parser.XMLComponent- Overrides:
getRecognizedFeaturesin classDefaultFilter
-
getFeatureDefault
public java.lang.Boolean getFeatureDefault(java.lang.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.- Specified by:
getFeatureDefaultin interfaceHTMLComponent- Specified by:
getFeatureDefaultin interfaceorg.apache.xerces.xni.parser.XMLComponent- Overrides:
getFeatureDefaultin classDefaultFilter
-
getRecognizedProperties
public java.lang.String[] 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 interfaceorg.apache.xerces.xni.parser.XMLComponent- Overrides:
getRecognizedPropertiesin classDefaultFilter
-
getPropertyDefault
public java.lang.Object getPropertyDefault(java.lang.String propertyId)
Returns the default value 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 interfaceorg.apache.xerces.xni.parser.XMLComponent- Overrides:
getPropertyDefaultin classDefaultFilter
-
reset
public void reset(org.apache.xerces.xni.parser.XMLComponentManager manager)
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 interfaceorg.apache.xerces.xni.parser.XMLComponent- Overrides:
resetin classDefaultFilter- Parameters:
manager- The component manager.
-
startDocument
public void startDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding, org.apache.xerces.xni.NamespaceContext nscontext, org.apache.xerces.xni.Augmentations augs)Start document.- Specified by:
startDocumentin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
startDocumentin classDefaultFilter
-
startElement
public void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs, org.apache.xerces.xni.Augmentations augs)Start element.- Specified by:
startElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
startElementin classDefaultFilter
-
emptyElement
public void emptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs, org.apache.xerces.xni.Augmentations augs)Empty element.- Specified by:
emptyElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
emptyElementin classDefaultFilter
-
endElement
public void endElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)End element.- Specified by:
endElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
endElementin classDefaultFilter
-
splitQName
protected static void splitQName(org.apache.xerces.xni.QName qname)
Splits a qualified name.
-
getNamesValue
protected static final short getNamesValue(java.lang.String value)
Converts HTML names string value to constant value.- See Also:
NAMES_NO_CHANGE,NAMES_LOWERCASE,NAMES_UPPERCASE
-
modifyName
protected static final java.lang.String modifyName(java.lang.String name, short mode)Modifies the given name based on the specified mode.
-
bindNamespaces
protected void bindNamespaces(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs)Binds namespaces.
-
-