public class

XMLNSDocumentScannerImpl

extends XMLDocumentScannerImpl
java.lang.Object
   ↳ org.apache.xerces.impl.XMLScanner
     ↳ org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
       ↳ org.apache.xerces.impl.XMLDocumentScannerImpl
         ↳ org.apache.xerces.impl.XMLNSDocumentScannerImpl

Class Overview

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:

  • http://xml.org/sax/features/namespaces {true} -- if the value of this feature is set to false this scanner must not be used.
  • http://xml.org/sax/features/validation
  • http://apache.org/xml/features/nonvalidating/load-external-dtd
  • http://apache.org/xml/features/scanner/notify-char-refs
  • http://apache.org/xml/features/scanner/notify-builtin-refs
  • http://apache.org/xml/properties/internal/symbol-table
  • http://apache.org/xml/properties/internal/error-reporter
  • http://apache.org/xml/properties/internal/entity-manager
  • http://apache.org/xml/properties/internal/dtd-scanner
@xerces.internal

Summary

Nested Classes
class XMLNSDocumentScannerImpl.NSContentDispatcher Dispatcher to handle content scanning. 
[Expand]
Inherited Constants
From class org.apache.xerces.impl.XMLDocumentScannerImpl
From class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
From class org.apache.xerces.impl.XMLScanner
Fields
protected boolean fBindNamespaces If is true, the dtd validator is no longer in the pipeline and the scanner should bind namespaces
protected boolean fPerformValidation If validating parser, make sure we report an error in the scanner if DTD grammar is missing.
[Expand]
Inherited Fields
From class org.apache.xerces.impl.XMLDocumentScannerImpl
From class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
From class org.apache.xerces.impl.XMLScanner
Public Constructors
XMLNSDocumentScannerImpl()
Public Methods
void reset(XMLComponentManager componentManager)
Resets the component.
void setDTDValidator(XMLDTDValidatorFilter dtdValidator)
The scanner is responsible for removing DTD validator from the pipeline if it is not needed.
Protected Methods
XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher()
Creates a content dispatcher.
void scanAttribute(XMLAttributesImpl attributes)
Scans an attribute.
int scanEndElement()
Scans an end element.
boolean scanStartElement()
Scans a start element.
boolean scanStartElementAfterName()
Scans the remainder of a start or empty tag after the element name.
void scanStartElementName()
Scans the name of an element in a start or empty tag.
[Expand]
Inherited Methods
From class org.apache.xerces.impl.XMLDocumentScannerImpl
From class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
From class org.apache.xerces.impl.XMLScanner
From class java.lang.Object
From interface org.apache.xerces.impl.XMLEntityHandler
From interface org.apache.xerces.xni.parser.XMLComponent
From interface org.apache.xerces.xni.parser.XMLDocumentScanner
From interface org.apache.xerces.xni.parser.XMLDocumentSource

Fields

protected boolean fBindNamespaces

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

protected boolean fPerformValidation

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

Public Constructors

public XMLNSDocumentScannerImpl ()

Public Methods

public void reset (XMLComponentManager componentManager)

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.

public void setDTDValidator (XMLDTDValidatorFilter dtdValidator)

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

Parameters
dtdValidator The DTDValidator

Protected Methods

protected XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher ()

Creates a content dispatcher.

protected void scanAttribute (XMLAttributesImpl attributes)

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 The attributes list for the scanned attribute.

protected int 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
  • The element depth.

protected boolean 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
  • True if element is empty. (i.e. It matches production [44].

protected boolean scanStartElementAfterName ()

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

Returns
  • True if element is empty.

protected void scanStartElementName ()

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