Top Description Inners Fields Constructors Methods
org.apache.xerces.impl

public Class XML11NSDocumentScannerImpl

extends XML11DocumentScannerImpl
Class Inheritance
Imports
java.io.IOException, org.apache.xerces.impl.dtd.XMLDTDValidatorFilter, org.apache.xerces.impl.msg.XMLMessageFormatter, org.apache.xerces.util.XMLAttributesImpl, .XMLSymbols, org.apache.xerces.xni.NamespaceContext, .QName, .XMLDocumentHandler, .XNIException, org.apache.xerces.xni.parser.XMLComponentManager, .XMLConfigurationException, .XMLDocumentSource

The scanner acts as the source for the document information which is communicated to the document handler. This class scans an XML document, checks if document has a DTD, and if DTD is not found the scanner will remove the DTD Validator from the pipeline and perform namespace binding.

Note

This scanner should only be used when the namespace processing is on!

This component requires the following features and properties from the component manager that uses it:

Authors
Elena Litani, IBM, Michael Glavassevich, IBM
Version
$Id: XML11NSDocumentScannerImpl.java 495747 2007-01-12 21:48:00Z mrglavas $

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
XML11NSDocumentScannerImpl.NS11ContentDispatcher

Dispatcher to handle content scanning.

Field Summary

Modifier and TypeField and Description
protected boolean
fBindNamespaces

If is true, the dtd validator is no longer in the pipeline and the scanner should bind namespaces

private XMLDTDValidatorFilter
fDTDValidator

DTD validator

protected boolean
fPerformValidation

If validating parser, make sure we report an error in the scanner if DTD grammar is missing.

private boolean
fSawSpace

Hides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.fSawSpace.

Saw spaces after element name or between attributes.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected XMLDocumentFragmentScannerImpl.Dispatcher
public void
reset(XMLComponentManager
The component manager.
componentManager
)

Overrides org.apache.xerces.impl.XMLDocumentScannerImpl.reset.

Implements org.apache.xerces.xni.parser.XMLComponent.reset.

Resets the component.
protected void
scanAttribute(XMLAttributesImpl
The attributes list for the scanned attribute.
attributes
)

Scans an attribute.

protected int

Returns:

The element depth.
scanEndElement
()

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement.

Scans an end element.
protected boolean

Returns:

True if element is empty. (i.e. It matches production [44].
scanStartElement
()

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement.

Scans a start element.
protected boolean

Returns:

True if element is empty.
scanStartElementAfterName
()

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElementAfterName.

Scans the remainder of a start or empty tag after the element name.
protected void
scanStartElementName()

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElementName.

Scans the name of an element in a start or empty tag.
public void
setDTDValidator(XMLDTDValidatorFilter
the DTD validator from the pipeline
validator
)

The scanner is responsible for removing DTD validator from the pipeline if it is not needed.

Inherited from org.apache.xerces.impl.XML11DocumentScannerImpl:
getVersionNotSupportedKeyisInvalidisInvalidLiteralisUnchangedByNormalizationisValidNameCharisValidNameStartCharisValidNameStartHighSurrogateisValidNCNamenormalizeWhitespacenormalizeWhitespacescanAttributeValuescanContentscanPubidLiteralversionSupported

Field Detail

fBindNamespacesback to summary
protected boolean fBindNamespaces

If is true, the dtd validator is no longer in the pipeline and the scanner should bind namespaces

fDTDValidatorback to summary
private XMLDTDValidatorFilter fDTDValidator

DTD validator

fPerformValidationback to summary
protected boolean fPerformValidation

If validating parser, make sure we report an error in the scanner if DTD grammar is missing.

fSawSpaceback to summary
private boolean fSawSpace

Hides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.fSawSpace.

Saw spaces after element name or between attributes. This is reserved for the case where scanning of a start element spans several methods, as is the case when scanning the start of a root element where a DTD external subset may be read after scanning the element name.

Constructor Detail

XML11NSDocumentScannerImplback to summary
public XML11NSDocumentScannerImpl()

Method Detail

createContentDispatcherback to summary
protected XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher()

Overrides org.apache.xerces.impl.XMLDocumentScannerImpl.createContentDispatcher.

Creates a content dispatcher.

resetback to summary
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException

Overrides org.apache.xerces.impl.XMLDocumentScannerImpl.reset.

Implements org.apache.xerces.xni.parser.XMLComponent.reset.

Doc from org.apache.xerces.impl.XMLDocumentScannerImpl.reset.

Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.

Parameters
componentManager:XMLComponentManager

The component manager.

scanAttributeback to summary
protected void scanAttribute(XMLAttributesImpl attributes) throws IOException, XNIException

Scans an attribute.

[41] Attribute ::= Name Eq AttValue

Note

This method assumes that the next character on the stream is the first character of the attribute name.

Note

This method uses the fAttributeQName and fQName variables. The contents of these variables will be destroyed.

Parameters
attributes:XMLAttributesImpl

The attributes list for the scanned attribute.

scanEndElementback to summary
protected int scanEndElement() throws IOException, XNIException

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement.

Scans an end element.

[42] ETag ::= '</' Name S? '>'

Note

This method uses the fElementQName variable. The contents of this variable will be destroyed. The caller should copy the needed information out of this variable before calling this method.

Returns:int

The element depth.

scanStartElementback to summary
protected boolean scanStartElement() throws IOException, XNIException

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement.

Scans a start element. This method will handle the binding of namespace information and notifying the handler of the start of the element.

[44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
[40] STag ::= '<' Name (S Attribute)* S? '>'

Note

This method assumes that the leading '<' character has been consumed.

Note

This method uses the fElementQName and fAttributes variables. The contents of these variables will be destroyed. The caller should copy important information out of these variables before calling this method.

Returns:boolean

True if element is empty. (i.e. It matches production [44].

scanStartElementAfterNameback to summary
protected boolean scanStartElementAfterName() throws IOException, XNIException

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElementAfterName.

Scans the remainder of a start or empty tag after the element name.

Returns:boolean

True if element is empty.

See Also
scanStartElement
scanStartElementNameback to summary
protected void scanStartElementName() throws IOException, XNIException

Overrides org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElementName.

Scans the name of an element in a start or empty tag.

See Also
scanStartElement()
setDTDValidatorback to summary
public void setDTDValidator(XMLDTDValidatorFilter validator)

The scanner is responsible for removing DTD validator from the pipeline if it is not needed.

Parameters
validator:XMLDTDValidatorFilter

the DTD validator from the pipeline

org.apache.xerces.impl back to summary

protected final Class XML11NSDocumentScannerImpl.NS11ContentDispatcher

extends ContentDispatcher
Class Inheritance

Dispatcher to handle content scanning.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private void
reconfigurePipeline()

Re-configures pipeline by removing the DTD validator if no DTD grammar exists.

protected boolean

Returns:

True if the caller should stop and return true which allows the scanner to switch to a new scanning dispatcher. A return value of false indicates that the content dispatcher should continue as normal.
scanRootElementHook
()

Overrides org.apache.xerces.impl.XMLDocumentScannerImpl.ContentDispatcher.scanRootElementHook.

Scan for root element hook.
Inherited from org.apache.xerces.impl.XMLDocumentScannerImpl.ContentDispatcher:
elementDepthIsZeroHookendOfFileHookresolveExternalSubsetAndReadscanForDoctypeHook

Constructor Detail

NS11ContentDispatcherback to summary
protected NS11ContentDispatcher()

Method Detail

reconfigurePipelineback to summary
private void reconfigurePipeline()

Re-configures pipeline by removing the DTD validator if no DTD grammar exists. If no validator exists in the pipeline or there is no DTD grammar, namespace binding is performed by the scanner in the enclosing class.

scanRootElementHookback to summary
protected boolean scanRootElementHook() throws IOException, XNIException

Overrides org.apache.xerces.impl.XMLDocumentScannerImpl.ContentDispatcher.scanRootElementHook.

Scan for root element hook. This method is a hook for subclasses to add code that handles scanning for the root element. This method will also attempt to remove DTD validator from the pipeline, if there is no DTD grammar. If DTD validator is no longer in the pipeline bind namespaces in the scanner.

Returns:boolean

True if the caller should stop and return true which allows the scanner to switch to a new scanning dispatcher. A return value of false indicates that the content dispatcher should continue as normal.