| java.lang.Object com.sun.xml.stream.XMLNamespaceBinder
XMLNamespaceBinder | public class XMLNamespaceBinder implements XMLComponent,XMLDocumentFilter(Code) | | This class performs namespace binding on the startElement and endElement
method calls and passes all other methods through to the registered
document handler. This class can be configured to only pass the
start and end prefix mappings (start/endPrefixMapping).
This component requires the following features and properties from the
component manager that uses it:
- http://xml.org/sax/features/namespaces
- http://apache.org/xml/properties/internal/symbol-table
- http://apache.org/xml/properties/internal/error-reporter
author: Andy Clark, IBM version: $Id: XMLNamespaceBinder.java,v 1.2 2006/04/01 06:01:48 jeffsuttor Exp $ |
Method Summary | |
public void | characters(XMLString text, Augmentations augs) Character content. | public void | comment(XMLString text, Augmentations augs) A comment. | public void | doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) Notifies of the presence of the DOCTYPE line in the document. | public void | emptyElement(QName element, XMLAttributes attributes, Augmentations augs) An empty element. | public void | endCDATA(Augmentations augs) The end of a CDATA section. | public void | endDocument(Augmentations augs) The end of the document. | public void | endElement(QName element, Augmentations augs) The end of an element. | public void | endGeneralEntity(String name, Augmentations augs) This method notifies the end of a general entity. | public void | endPrefixMapping(String prefix, Augmentations augs) The end of a namespace prefix mapping. | public XMLDocumentHandler | getDocumentHandler() | public XMLDocumentSource | getDocumentSource() | 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. | public NamespaceContext | getNamespaceContext() Returns the current namespace context. | public boolean | getOnlyPassPrefixMappingEvents() Returns true if the namespace binder only passes the prefix mapping
events to the registered document handler; false if the namespace
binder passes all document events. | public Object | 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. | public String[] | getRecognizedFeatures() Returns a list of feature identifiers that are recognized by
this component. | public String[] | getRecognizedProperties() Returns a list of property identifiers that are recognized by
this component. | protected void | handleEndElement(QName element, Augmentations augs, boolean isEmpty) Handles end element. | protected void | handleStartElement(QName element, XMLAttributes attributes, Augmentations augs, boolean isEmpty) Handles start element. | public void | ignorableWhitespace(XMLString text, Augmentations augs) Ignorable whitespace. | public void | processingInstruction(String target, XMLString data, Augmentations augs) A processing instruction. | public void | reset(XMLComponentManager componentManager) Resets the component. | public void | setDocumentHandler(XMLDocumentHandler documentHandler) Sets the document handler to receive information about the document. | public void | setDocumentSource(XMLDocumentSource source) | public void | setFeature(String featureId, boolean state) Sets the state of a feature. | public void | setOnlyPassPrefixMappingEvents(boolean onlyPassPrefixMappingEvents) Sets whether the namespace binder only passes the prefix mapping
events to the registered document handler or passes all document
events. | public void | setProperty(String propertyId, Object value) Sets the value of a property during parsing. | public void | startCDATA(Augmentations augs) The start of a CDATA section. | public void | startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) The start of the document.
Parameters: locator - The system identifier of the entity if the entityis external, null otherwise. Parameters: encoding - The auto-detected IANA encoding name of the entitystream. | public void | startElement(QName element, XMLAttributes attributes, Augmentations augs) Binds the namespaces. | public void | startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) This method notifies the start of a general entity.
Note: This method is not called for entity references
appearing as part of attribute values.
Parameters: name - The name of the general entity. Parameters: identifier - The resource identifier. Parameters: encoding - The auto-detected IANA encoding name of the entitystream. | public void | startPrefixMapping(String prefix, String uri, Augmentations augs) The start of a namespace prefix mapping. | public void | textDecl(String version, String encoding, Augmentations augs) Notifies of the presence of a TextDecl line in an entity. | public void | xmlDecl(String version, String encoding, String standalone, Augmentations augs) Notifies of the presence of an XMLDecl line in the document. |
ERROR_REPORTER | final protected static String ERROR_REPORTER(Code) | | Property identifier: error reporter.
|
NAMESPACES | final protected static String NAMESPACES(Code) | | Feature identifier: namespaces.
|
SYMBOL_TABLE | final protected static String SYMBOL_TABLE(Code) | | Property identifier: symbol table.
|
fNamespaces | protected boolean fNamespaces(Code) | | Namespaces.
|
fOnlyPassPrefixMappingEvents | protected boolean fOnlyPassPrefixMappingEvents(Code) | | Only pass start and end prefix mapping events.
|
XMLNamespaceBinder | public XMLNamespaceBinder()(Code) | | Default constructor.
|
XMLNamespaceBinder | public XMLNamespaceBinder(NamespaceContext namespaceContext)(Code) | | Constructs a namespace binder that shares the specified namespace
context during each parse.
Parameters: namespaceContext - The shared context. |
characters | public void characters(XMLString text, Augmentations augs) throws XNIException(Code) | | Character content.
Parameters: text - The content. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
comment | public void comment(XMLString text, Augmentations augs) throws XNIException(Code) | | A comment.
Parameters: text - The text in the comment. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by application to signal an error. |
doctypeDecl | public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException(Code) | | Notifies of the presence of the DOCTYPE line in the document.
Parameters: rootElement - The name of the root element. Parameters: publicId - The public identifier if an external DTD or nullif the external DTD is specified using SYSTEM. Parameters: systemId - The system identifier if an external DTD, nullotherwise. Parameters: 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(Code) | | An empty element.
Parameters: element - The name of the element. Parameters: attributes - The element attributes. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
endCDATA | public void endCDATA(Augmentations augs) throws XNIException(Code) | | The end of a CDATA section.
Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
endDocument | public void endDocument(Augmentations augs) throws XNIException(Code) | | The end of the document.
Parameters: 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(Code) | | The end of an element.
Parameters: element - The name of the element. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
endGeneralEntity | public void endGeneralEntity(String name, Augmentations augs) throws XNIException(Code) | | This method notifies the end of a general entity.
Note: This method is not called for entity references
appearing as part of attribute values.
Parameters: name - The name of the entity. Parameters: augs - Additional information that may include infoset augmentations exception: XNIException - Thrown by handler to signal an error. |
endPrefixMapping | public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException(Code) | | The end of a namespace prefix mapping. This method will only be
called when namespace processing is enabled.
Parameters: prefix - The namespace prefix. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
getFeatureDefault | public Boolean getFeatureDefault(String featureId)(Code) | | Returns the default state for a feature, or null if this
component does not want to report a default value for this
feature.
Parameters: featureId - The feature identifier. since: Xerces 2.2.0 |
getOnlyPassPrefixMappingEvents | public boolean getOnlyPassPrefixMappingEvents()(Code) | | Returns true if the namespace binder only passes the prefix mapping
events to the registered document handler; false if the namespace
binder passes all document events.
|
getPropertyDefault | public Object getPropertyDefault(String propertyId)(Code) | | Returns the default state for a property, or null if this
component does not want to report a default value for this
property.
Parameters: propertyId - The property identifier. since: Xerces 2.2.0 |
getRecognizedFeatures | public String[] getRecognizedFeatures()(Code) | | 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.
|
getRecognizedProperties | public String[] getRecognizedProperties()(Code) | | 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.
|
ignorableWhitespace | public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException(Code) | | Ignorable whitespace. For this method to be called, the document
source must have some way of determining that the text containing
only whitespace characters should be considered ignorable. For
example, the validator can determine if a length of whitespace
characters in the document are ignorable based on the element
content model.
Parameters: text - The ignorable whitespace. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
processingInstruction | public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException(Code) | | A processing instruction. Processing instructions consist of a
target name and, optionally, text data. The data is only meaningful
to the application.
Typically, a processing instruction's data will contain a series
of pseudo-attributes. These pseudo-attributes follow the form of
element attributes but are not parsed or presented
to the application as anything other than text. The application is
responsible for parsing the data.
Parameters: target - The target. Parameters: data - The data or null if none specified. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
reset | public void reset(XMLComponentManager componentManager) throws XNIException(Code) | | Resets the component. The component can query the component manager
about any features and properties that affect the operation of the
component.
Parameters: componentManager - The component manager. throws: SAXException - Thrown by component on initialization error.For example, if a feature or property isrequired for the operation of the component, thecomponent manager may throw aSAXNotRecognizedException or aSAXNotSupportedException. |
setDocumentHandler | public void setDocumentHandler(XMLDocumentHandler documentHandler)(Code) | | Sets the document handler to receive information about the document.
|
setFeature | public void setFeature(String featureId, boolean state) throws XMLConfigurationException(Code) | | 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.
Parameters: featureId - The feature identifier. Parameters: state - The state of the feature. throws: SAXNotRecognizedException - The component should not throwthis exception. throws: SAXNotSupportedException - The component should not throwthis exception. |
setOnlyPassPrefixMappingEvents | public void setOnlyPassPrefixMappingEvents(boolean onlyPassPrefixMappingEvents)(Code) | | Sets whether the namespace binder only passes the prefix mapping
events to the registered document handler or passes all document
events.
Parameters: onlyPassPrefixMappingEvents - True to pass only the prefixmapping events; false to passall events. |
startCDATA | public void startCDATA(Augmentations augs) throws XNIException(Code) | | The start of a CDATA section.
Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
startDocument | public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException(Code) | | The start of the document.
Parameters: locator - The system identifier of the entity if the entityis external, null otherwise. Parameters: encoding - The auto-detected IANA encoding name of the entitystream. This value will be null in those situationswhere the entity encoding is not auto-detected (e.g.internal entities or a document entity that isparsed from a java.io.Reader). Parameters: namespaceContext - The namespace context in effect at thestart of this document.This object represents the current context.Implementors of this class are responsiblefor copying the namespace bindings from thethe current context (and its parent contexts)if that information is important. Parameters: 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(Code) | | Binds the namespaces. This method will handle calling the
document handler to start the prefix mappings.
Note: This method makes use of the
fAttributeQName variable. Any contents of the variable will
be destroyed. Caller should copy the values out of this
temporary variable before calling this method.
Parameters: element - The name of the element. Parameters: attributes - The element attributes. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
startGeneralEntity | public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException(Code) | | This method notifies the start of a general entity.
Note: This method is not called for entity references
appearing as part of attribute values.
Parameters: name - The name of the general entity. Parameters: identifier - The resource identifier. Parameters: encoding - The auto-detected IANA encoding name of the entitystream. This value will be null in those situationswhere the entity encoding is not auto-detected (e.g.internal entities or a document entity that isparsed from a java.io.Reader). Parameters: augs - Additional information that may include infoset augmentations exception: XNIException - Thrown by handler to signal an error. |
startPrefixMapping | public void startPrefixMapping(String prefix, String uri, Augmentations augs) throws XNIException(Code) | | The start of a namespace prefix mapping. This method will only be
called when namespace processing is enabled.
Parameters: prefix - The namespace prefix. Parameters: uri - The URI bound to the prefix. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
textDecl | public void textDecl(String version, String encoding, Augmentations augs) throws XNIException(Code) | | Notifies of the presence of a TextDecl line in an entity. If present,
this method will be called immediately following the startEntity call.
Note: This method will never be called for the
document entity; it is only called for external general entities
referenced in document content.
Note: This method is not called for entity references
appearing as part of attribute values.
Parameters: version - The XML version, or null if not specified. Parameters: encoding - The IANA encoding name of the entity. Parameters: 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(Code) | | Notifies of the presence of an XMLDecl line in the document. If
present, this method will be called immediately following the
startDocument call.
Parameters: version - The XML version. Parameters: encoding - The IANA encoding name of the document, or null ifnot specified. Parameters: standalone - The standalone value, or null if not specified. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
|
|