org.apache.xerces.impl
Class XML11DocumentScannerImpl

java.lang.Object
  |
  +--org.apache.xerces.impl.XMLScanner
        |
        +--org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
              |
              +--org.apache.xerces.impl.XMLDocumentScannerImpl
                    |
                    +--org.apache.xerces.impl.XML11DocumentScannerImpl
All Implemented Interfaces:
org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDocumentScanner, org.apache.xerces.xni.parser.XMLDocumentSource, XMLEntityHandler

public class XML11DocumentScannerImpl
extends XMLDocumentScannerImpl

This class is responsible for scanning XML document structure and content. The scanner acts as the source for the document information which is communicated to the document handler.

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

Version:
$Id: XML11DocumentScannerImpl.java,v 1.4 2002/12/09 18:51:29 neilg Exp $
Author:
Glenn Marcy, IBM, Andy Clark, IBM, Arnaud Le Hors, IBM, Eric Ye, IBM

Inner classes inherited from class org.apache.xerces.impl.XMLDocumentScannerImpl
XMLDocumentScannerImpl.ContentDispatcher, XMLDocumentScannerImpl.DTDDispatcher, XMLDocumentScannerImpl.PrologDispatcher, XMLDocumentScannerImpl.TrailingMiscDispatcher, XMLDocumentScannerImpl.XMLDeclDispatcher
 
Inner classes inherited from class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
XMLDocumentFragmentScannerImpl.Dispatcher, XMLDocumentFragmentScannerImpl.ElementStack, XMLDocumentFragmentScannerImpl.FragmentContentDispatcher
 
Fields inherited from class org.apache.xerces.impl.XMLDocumentScannerImpl
DISALLOW_DOCTYPE_DECL_FEATURE, DTD_SCANNER, fDisallowDoctype, fDoctypeName, fDoctypePublicId, fDoctypeSystemId, fDTDDispatcher, fDTDScanner, fLoadExternalDTD, fNamespaceContext, fPrologDispatcher, fScanningDTD, fSeenDoctypeDecl, fTrailingMiscDispatcher, fValidationManager, fXMLDeclDispatcher, LOAD_EXTERNAL_DTD, SCANNER_STATE_DTD_EXTERNAL, SCANNER_STATE_DTD_EXTERNAL_DECLS, SCANNER_STATE_DTD_INTERNAL_DECLS, SCANNER_STATE_PROLOG, SCANNER_STATE_TRAILING_MISC, SCANNER_STATE_XML_DECL, VALIDATION_MANAGER
 
Fields inherited from class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
DEBUG_CONTENT_SCANNING, fAttributeQName, fAttributes, fContentDispatcher, fCurrentElement, fDispatcher, fDocumentHandler, fElementQName, fElementStack, fEntityStack, fHasExternalDTD, fInScanContent, fMarkupDepth, fNamespaces, fNotifyBuiltInRefs, fScannerState, fStandalone, fTempString, fTempString2, NAMESPACES, NOTIFY_BUILTIN_REFS, SCANNER_STATE_CDATA, SCANNER_STATE_COMMENT, SCANNER_STATE_CONTENT, SCANNER_STATE_DOCTYPE, SCANNER_STATE_END_OF_INPUT, SCANNER_STATE_PI, SCANNER_STATE_REFERENCE, SCANNER_STATE_ROOT_ELEMENT, SCANNER_STATE_START_OF_MARKUP, SCANNER_STATE_TERMINATED, SCANNER_STATE_TEXT_DECL
 
Fields inherited from class org.apache.xerces.impl.XMLScanner
DEBUG_ATTR_NORMALIZATION, ENTITY_MANAGER, ERROR_REPORTER, fAmpSymbol, fAposSymbol, fCharRefLiteral, fEncodingSymbol, fEntityDepth, fEntityManager, fEntityScanner, fErrorReporter, fGtSymbol, fLtSymbol, fNotifyCharRefs, fQuotSymbol, fReportEntity, fResourceIdentifier, fScanningAttribute, fStandaloneSymbol, fSymbolTable, fValidation, fVersionSymbol, NOTIFY_CHAR_REFS, SYMBOL_TABLE, VALIDATION
 
Constructor Summary
XML11DocumentScannerImpl()
          Default constructor.
 
Method Summary
protected  boolean isInvalid(int value)
           
protected  boolean isInvalidLiteral(int value)
           
protected  boolean isValidNameChar(int value)
           
protected  boolean isValidNameStartChar(int value)
           
protected  void normalizeWhitespace(org.apache.xerces.xni.XMLString value)
          Normalize whitespace in an XMLString converting all whitespace characters to space characters.
protected  void scanAttributeValue(org.apache.xerces.xni.XMLString value, org.apache.xerces.xni.XMLString nonNormalizedValue, java.lang.String atName, org.apache.xerces.xni.XMLAttributes attributes, int attrIndex, boolean checkEntities)
          Scans an attribute value and normalizes whitespace converting all whitespace characters to space characters.
protected  int scanContent()
          Scans element content.
protected  boolean scanPubidLiteral(org.apache.xerces.xni.XMLString literal)
          Scans public ID literal.
protected  void scanXMLDeclOrTextDecl(boolean scanningTextDecl, java.lang.String[] pseudoAttributeValues)
          Scans an XML or text declaration.
protected  boolean versionSupported(java.lang.String version)
           
 
Methods inherited from class org.apache.xerces.impl.XMLDocumentScannerImpl
createContentDispatcher, endEntity, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, getScannerStateName, reset, scanDoctypeDecl, setFeature, setInputSource, setProperty, startEntity
 
Methods inherited from class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
getDispatcherName, getDocumentHandler, handleEndElement, scanAttribute, scanCDATASection, scanCharReference, scanComment, scanDocument, scanEndElement, scanEntityReference, scanPIData, scanStartElement, scanXMLDeclOrTextDecl, setDispatcher, setDocumentHandler, setScannerState
 
Methods inherited from class org.apache.xerces.impl.XMLScanner
getFeature, reportFatalError, reset, scanCharReferenceValue, scanComment, scanExternalID, scanPI, scanPseudoAttribute, scanSurrogates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XML11DocumentScannerImpl

public XML11DocumentScannerImpl()
Default constructor.
Method Detail

scanContent

protected int scanContent()
                   throws java.io.IOException,
                          org.apache.xerces.xni.XNIException
Scans element content.
Overrides:
scanContent in class XMLDocumentFragmentScannerImpl
Returns:
Returns the next character on the stream.

scanXMLDeclOrTextDecl

protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl,
                                     java.lang.String[] pseudoAttributeValues)
                              throws java.io.IOException,
                                     org.apache.xerces.xni.XNIException
Scans an XML or text declaration.

 [23] XMLDecl ::= ''
 [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
 [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' |  "'" EncName "'" )
 [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
 [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'")
                 | ('"' ('yes' | 'no') '"'))

 [77] TextDecl ::= ''
 

this was overridden to allow for version="1.1"

Overrides:
scanXMLDeclOrTextDecl in class XMLScanner
Parameters:
scanningTextDecl - True if a text declaration is to be scanned instead of an XML declaration.
pseudoAttributeValues - An array of size 3 to return the version, encoding and standalone pseudo attribute values (in that order). Note: This method uses fString, anything in it at the time of calling is lost.

scanAttributeValue

protected void scanAttributeValue(org.apache.xerces.xni.XMLString value,
                                  org.apache.xerces.xni.XMLString nonNormalizedValue,
                                  java.lang.String atName,
                                  org.apache.xerces.xni.XMLAttributes attributes,
                                  int attrIndex,
                                  boolean checkEntities)
                           throws java.io.IOException,
                                  org.apache.xerces.xni.XNIException
Scans an attribute value and normalizes whitespace converting all whitespace characters to space characters. [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
Overrides:
scanAttributeValue in class XMLScanner
Parameters:
value - The XMLString to fill in with the value.
nonNormalizedValue - The XMLString to fill in with the non-normalized value.
atName - The name of the attribute being parsed (for error msgs).
attributes - The attributes list for the scanned attribute.
attrIndex - The index of the attribute to use from the list.
checkEntities - true if undeclared entities should be reported as VC violation, false if undeclared entities should be reported as WFC violation. Note: This method uses fStringBuffer2, anything in it at the time of calling is lost.

scanPubidLiteral

protected boolean scanPubidLiteral(org.apache.xerces.xni.XMLString literal)
                            throws java.io.IOException,
                                   org.apache.xerces.xni.XNIException
Scans public ID literal. [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] The returned string is normalized according to the following rule, from http://www.w3.org/TR/REC-xml#dt-pubid: Before a match is attempted, all strings of white space in the public identifier must be normalized to single space characters (#x20), and leading and trailing white space must be removed.
Overrides:
scanPubidLiteral in class XMLScanner
Parameters:
literal - The string to fill in with the public ID literal.
Returns:
True on success. Note: This method uses fStringBuffer, anything in it at the time of calling is lost.

normalizeWhitespace

protected void normalizeWhitespace(org.apache.xerces.xni.XMLString value)
Normalize whitespace in an XMLString converting all whitespace characters to space characters.
Overrides:
normalizeWhitespace in class XMLScanner

isInvalid

protected boolean isInvalid(int value)
Overrides:
isInvalid in class XMLScanner

isInvalidLiteral

protected boolean isInvalidLiteral(int value)
Overrides:
isInvalidLiteral in class XMLScanner

isValidNameChar

protected boolean isValidNameChar(int value)
Overrides:
isValidNameChar in class XMLScanner

isValidNameStartChar

protected boolean isValidNameStartChar(int value)
Overrides:
isValidNameStartChar in class XMLScanner

versionSupported

protected boolean versionSupported(java.lang.String version)
Overrides:
versionSupported in class XMLScanner


Copyright © 1999-2003 Apache XML Project. All Rights Reserved.