org.cyberneko.html.filters

Class NamespaceBinder

Implemented Interfaces:
XMLComponent, XMLDocumentFilter, 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 to true.

This configuration recognizes the following features:

Version:
$Id: NamespaceBinder.java,v 1.8 2005/05/30 00:19:28 andyc Exp $
Author:
Andy Clark

Nested Class Summary

static class
NamespaceBinder.NamespaceSupport
This namespace context object implements the old and new XNI NamespaceContext interface methods so that it can be used across all versions of Xerces2.

Field Summary

protected static String
INSERT_NAMESPACES
Insert namespace binding URIs.
protected static String
NAMESPACES
Namespaces.
protected static String
NAMESPACES_URI
Namespaces URI.
protected static String
NAMES_ATTRS
Modify HTML attribute names: { "upper", "lower", "default" }.
protected static String
NAMES_ELEMS
Modify HTML element names: { "upper", "lower", "default" }.
protected static short
NAMES_LOWERCASE
Lowercase HTML names.
protected static short
NAMES_NO_CHANGE
Don't modify HTML names.
protected static short
NAMES_UPPERCASE
Uppercase HTML names.
protected static String
OVERRIDE_NAMESPACES
Override namespace binding URI.
static String
XHTML_1_0_URI
XHTML 1.0 namespace URI (http://www.w3.org/1999/xhtml).
static String
XMLNS_URI
XMLNS namespace URI (http://www.w3.org/2000/xmlns/).
static String
XML_URI
XML namespace URI (http://www.w3.org/XML/1998/namespace).
protected boolean
fInsertNamespaces
Insert namespaces.
protected short
fNamesAttrs
Modify HTML attribute names.
protected short
fNamesElems
Modify HTML element names.
protected NamespaceBinder.NamespaceSupport
fNamespaceContext
Namespace context.
protected boolean
fNamespacePrefixes
Namespace prefixes.
protected boolean
fNamespaces
Namespaces.
protected String
fNamespacesURI
Namespaces URI.
protected boolean
fOverrideNamespaces
Override namespaces.

Fields inherited from class org.cyberneko.html.filters.DefaultFilter

fDocumentHandler, fDocumentSource

Method Summary

protected void
bindNamespaces(QName element, XMLAttributes attrs)
Binds namespaces.
void
emptyElement(QName element, XMLAttributes attrs, Augmentations augs)
Empty element.
void
endElement(QName element, Augmentations augs)
End element.
Boolean
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.
protected static short
getNamesValue(String value)
Converts HTML names string value to constant value.
Object
getPropertyDefault(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.
String[]
getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this component.
String[]
getRecognizedProperties()
Returns a list of property identifiers that are recognized by this component.
protected static String
modifyName(String name, short mode)
Modifies the given name based on the specified mode.
void
reset(XMLComponentManager manager)
Resets the component.
protected static void
splitQName(QName qname)
Splits a qualified name.
void
startDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs)
Start document.
void
startElement(QName element, XMLAttributes attrs, Augmentations augs)
Start element.

Methods inherited from class org.cyberneko.html.filters.DefaultFilter

characters, comment, doctypeDecl, emptyElement, endCDATA, endDocument, endElement, endGeneralEntity, endPrefixMapping, getDocumentHandler, getDocumentSource, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, ignorableWhitespace, merge, processingInstruction, reset, setDocumentHandler, setDocumentSource, setFeature, setProperty, startCDATA, startDocument, startDocument, startElement, startGeneralEntity, startPrefixMapping, textDecl, xmlDecl

Field Details

INSERT_NAMESPACES

protected static final String INSERT_NAMESPACES
Insert namespace binding URIs.

NAMESPACES

protected static final String NAMESPACES
Namespaces.

NAMESPACES_URI

protected static final String NAMESPACES_URI
Namespaces URI.

NAMES_ATTRS

protected static final String NAMES_ATTRS
Modify HTML attribute names: { "upper", "lower", "default" }.

NAMES_ELEMS

protected static final String NAMES_ELEMS
Modify HTML element names: { "upper", "lower", "default" }.

NAMES_LOWERCASE

protected static final short NAMES_LOWERCASE
Lowercase HTML names.
Field Value:
2

NAMES_NO_CHANGE

protected static final short NAMES_NO_CHANGE
Don't modify HTML names.
Field Value:
0

NAMES_UPPERCASE

protected static final short NAMES_UPPERCASE
Uppercase HTML names.
Field Value:
1

OVERRIDE_NAMESPACES

protected static final String OVERRIDE_NAMESPACES
Override namespace binding URI.

XHTML_1_0_URI

public static final String XHTML_1_0_URI
XHTML 1.0 namespace URI (http://www.w3.org/1999/xhtml).

XMLNS_URI

public static final String XMLNS_URI
XMLNS namespace URI (http://www.w3.org/2000/xmlns/).

XML_URI

public static final String XML_URI
XML namespace URI (http://www.w3.org/XML/1998/namespace).

fInsertNamespaces

protected boolean fInsertNamespaces
Insert namespaces.

fNamesAttrs

protected short fNamesAttrs
Modify HTML attribute names.

fNamesElems

protected short fNamesElems
Modify HTML element names.

fNamespaceContext

protected final NamespaceBinder.NamespaceSupport fNamespaceContext
Namespace context.

fNamespacePrefixes

protected boolean fNamespacePrefixes
Namespace prefixes.

fNamespaces

protected boolean fNamespaces
Namespaces.

fNamespacesURI

protected String fNamespacesURI
Namespaces URI.

fOverrideNamespaces

protected boolean fOverrideNamespaces
Override namespaces.

Method Details

bindNamespaces

protected void bindNamespaces(QName element,
                              XMLAttributes attrs)
Binds namespaces.

emptyElement

public void emptyElement(QName element,
                         XMLAttributes attrs,
                         Augmentations augs)
            throws XNIException
Empty element.
Overrides:
emptyElement in interface DefaultFilter

endElement

public void endElement(QName element,
                       Augmentations augs)
            throws XNIException
End element.
Overrides:
endElement in interface DefaultFilter

getFeatureDefault

public Boolean 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.
Specified by:
getFeatureDefault in interface HTMLComponent
Overrides:
getFeatureDefault in interface DefaultFilter

getNamesValue

protected static final short getNamesValue(String value)
Converts HTML names string value to constant value.

getPropertyDefault

public Object getPropertyDefault(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:
getPropertyDefault in interface HTMLComponent
Overrides:
getPropertyDefault in interface DefaultFilter

getRecognizedFeatures

public 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.
Overrides:
getRecognizedFeatures in interface DefaultFilter

getRecognizedProperties

public 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.
Overrides:
getRecognizedProperties in interface DefaultFilter

modifyName

protected static final String modifyName(String name,
                                         short mode)
Modifies the given name based on the specified mode.

reset

public void reset(XMLComponentManager manager)
            throws XMLConfigurationException
Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.
Overrides:
reset in interface DefaultFilter
Parameters:
manager - The component manager.

splitQName

protected static void splitQName(QName qname)
Splits a qualified name.

startDocument

public void startDocument(XMLLocator locator,
                          String encoding,
                          NamespaceContext nscontext,
                          Augmentations augs)
            throws XNIException
Start document.
Overrides:
startDocument in interface DefaultFilter

startElement

public void startElement(QName element,
                         XMLAttributes attrs,
                         Augmentations augs)
            throws XNIException
Start element.
Overrides:
startElement in interface DefaultFilter

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