Class NamespaceBinder

java.lang.Object
org.htmlunit.cyberneko.filters.DefaultFilter
org.htmlunit.cyberneko.filters.NamespaceBinder
All Implemented Interfaces:
HTMLComponent, XMLComponent, XMLDocumentFilter, XMLDocumentSource, XMLDocumentHandler

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:

  • http://xml.org/sax/features/namespaces
Author:
Andy Clark
  • Field Details

    • XHTML_1_0_URI

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

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

      public static final String XMLNS_URI
      XMLNS namespace URI (http://www.w3.org/2000/xmlns/).
      See Also:
  • Constructor Details

  • Method Details

    • 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.
      Specified by:
      getRecognizedFeatures in interface XMLComponent
      Overrides:
      getRecognizedFeatures in class DefaultFilter
      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

      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
      Specified by:
      getFeatureDefault in interface XMLComponent
      Overrides:
      getFeatureDefault in class DefaultFilter
      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

      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.
      Specified by:
      getRecognizedProperties in interface XMLComponent
      Overrides:
      getRecognizedProperties in class DefaultFilter
      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

      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
      Specified by:
      getPropertyDefault in interface XMLComponent
      Overrides:
      getPropertyDefault in class DefaultFilter
      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

      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.
      Specified by:
      reset in interface XMLComponent
      Overrides:
      reset in class DefaultFilter
      Parameters:
      manager - The component manager.
      Throws:
      XNIException - Thrown by component on initialization error.
      XMLConfigurationException
    • startDocument

      public void startDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs) throws XNIException
      Start document.
      Specified by:
      startDocument in interface XMLDocumentHandler
      Overrides:
      startDocument in class DefaultFilter
      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.
    • startElement

      public void startElement(QName element, XMLAttributes attrs, Augmentations augs) throws XNIException
      Start element.
      Specified by:
      startElement in interface XMLDocumentHandler
      Overrides:
      startElement in class DefaultFilter
      Parameters:
      element - The name of the element.
      attrs - 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 attrs, Augmentations augs) throws XNIException
      Empty element.
      Specified by:
      emptyElement in interface XMLDocumentHandler
      Overrides:
      emptyElement in class DefaultFilter
      Parameters:
      element - The name of the element.
      attrs - The element attributes.
      augs - Additional information that may include infoset augmentations
      Throws:
      XNIException - Thrown by handler to signal an error.
    • endElement

      public void endElement(QName element, Augmentations augs) throws XNIException
      End element.
      Specified by:
      endElement in interface XMLDocumentHandler
      Overrides:
      endElement in class DefaultFilter
      Parameters:
      element - The name of the element.
      augs - Additional information that may include infoset augmentations
      Throws:
      XNIException - Thrown by handler to signal an error.
    • getNamesValue

      protected static short getNamesValue(String value)
    • modifyName

      protected static String modifyName(String name, short mode)
    • bindNamespaces

      protected void bindNamespaces(QName element, XMLAttributes attrs)