Top Description Inners Fields Constructors Methods
com.sun.org.apache.xerces.internal.impl

public Class XML11NSDocumentScannerImpl

extends XML11DocumentScannerImpl
Class Inheritance
Imports
java.io.IOException, com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidatorFilter, com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter, com.sun.org.apache.xerces.internal.util.XMLAttributesImpl, .XMLSymbols, com.sun.org.apache.xerces.internal.xni.NamespaceContext, .QName, .XMLDocumentHandler, .XNIException, com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager, .XMLConfigurationException, .XMLDocumentSource, javax.xml.stream.events.XMLEvent, jdk.xml.internal.XMLSecurityManager

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, Sunitha Reddy, Sun Microsystems

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
XML11NSDocumentScannerImpl.NS11ContentDriver

Driver 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

Saw spaces after element name or between attributes.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected XMLDocumentFragmentScannerImpl.Driver
public int
public void
protected void
scanAttribute(XMLAttributesImpl
The attributes list for the scanned attribute.
attributes
)

Scans an attribute.

protected int
protected boolean

Returns:

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

Overrides com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement.

Scans a start element.

protected boolean

Returns:

True if element is empty.
scanStartElementAfterName
()

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

protected void
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 com.sun.org.apache.xerces.internal.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

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

createContentDriverback to summary
protected XMLDocumentFragmentScannerImpl.Driver createContentDriver()

Overrides com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.createContentDriver.

Creates a content Driver.

nextback to summary
public int next() throws IOException, XNIException

Overrides com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next.

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner.next.

return the next state on the input

Returns:int

int

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

Overrides com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.reset.

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.reset.

Doc from com.sun.org.apache.xerces.internal.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 com.sun.org.apache.xerces.internal.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 com.sun.org.apache.xerces.internal.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

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

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

com.sun.org.apache.xerces.internal.impl back to summary

protected final Class XML11NSDocumentScannerImpl.NS11ContentDriver

extends ContentDriver
Class Inheritance

Driver 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 Driver. A return value of false indicates that the content Driver should continue as normal.
scanRootElementHook
()

Overrides com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.ContentDriver.scanRootElementHook.

Scan for root element hook.

Inherited from com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.ContentDriver:
elementDepthIsZeroHookendOfFileHookresolveExternalSubsetAndReadscanForDoctypeHook

Constructor Detail

NS11ContentDriverback to summary
protected NS11ContentDriver()

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 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.ContentDriver.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 Driver. A return value of false indicates that the content Driver should continue as normal.