Fields Summary |
---|
protected static final int | SCANNER_STATE_START_OF_MARKUPScanner state: start of markup. |
protected static final int | SCANNER_STATE_COMMENTScanner state: comment. |
protected static final int | SCANNER_STATE_PIScanner state: processing instruction. |
protected static final int | SCANNER_STATE_DOCTYPEScanner state: DOCTYPE. |
protected static final int | SCANNER_STATE_ROOT_ELEMENTScanner state: root element. |
protected static final int | SCANNER_STATE_CONTENTScanner state: content. |
protected static final int | SCANNER_STATE_REFERENCEScanner state: reference. |
protected static final int | SCANNER_STATE_END_OF_INPUTScanner state: end of input. |
protected static final int | SCANNER_STATE_TERMINATEDScanner state: terminated. |
protected static final int | SCANNER_STATE_CDATAScanner state: CDATA section. |
protected static final int | SCANNER_STATE_TEXT_DECLScanner state: Text declaration. |
protected static final String | NAMESPACESFeature identifier: namespaces. |
protected static final String | NOTIFY_BUILTIN_REFSFeature identifier: notify built-in refereces. |
protected static final String | ENTITY_RESOLVERProperty identifier: entity resolver. |
private static final String[] | RECOGNIZED_FEATURESRecognized features. |
private static final Boolean[] | FEATURE_DEFAULTSFeature defaults. |
private static final String[] | RECOGNIZED_PROPERTIESRecognized properties. |
private static final Object[] | PROPERTY_DEFAULTSProperty defaults. |
private static final boolean | DEBUG_SCANNER_STATEDebug scanner state. |
private static final boolean | DEBUG_DISPATCHERDebug dispatcher. |
protected static final boolean | DEBUG_CONTENT_SCANNINGDebug content dispatcher scanning. |
protected org.apache.xerces.xni.XMLDocumentHandler | fDocumentHandlerDocument handler. |
protected int[] | fEntityStackEntity stack. |
protected int | fMarkupDepthMarkup depth. |
protected int | fScannerStateScanner state. |
protected boolean | fInScanContentSubScanner state: inside scanContent method. |
protected boolean | fHasExternalDTDhas external dtd |
protected boolean | fStandaloneStandalone. |
protected boolean | fIsEntityDeclaredVCTrue if [Entity Declared] is a VC; false if it is a WFC. |
protected ExternalSubsetResolver | fExternalSubsetResolverExternal subset resolver. |
protected org.apache.xerces.xni.QName | fCurrentElementCurrent element. |
protected final ElementStack | fElementStackElement stack. |
protected boolean | fNotifyBuiltInRefsNotify built-in references. |
protected Dispatcher | fDispatcherActive dispatcher. |
protected final Dispatcher | fContentDispatcherContent dispatcher. |
protected final org.apache.xerces.xni.QName | fElementQNameElement QName. |
protected final org.apache.xerces.xni.QName | fAttributeQNameAttribute QName. |
protected final org.apache.xerces.util.XMLAttributesImpl | fAttributesElement attributes. |
protected final org.apache.xerces.xni.XMLString | fTempStringString. |
protected final org.apache.xerces.xni.XMLString | fTempString2String. |
private final String[] | fStringsArray of 3 strings. |
private final org.apache.xerces.util.XMLStringBuffer | fStringBufferString buffer. |
private final org.apache.xerces.util.XMLStringBuffer | fStringBuffer2String buffer. |
private final org.apache.xerces.xni.QName | fQNameAnother QName. |
private final char[] | fSingleCharSingle character array. |
private boolean | fSawSpaceSaw 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. |
private org.apache.xerces.xni.Augmentations | fTempAugmentationsReusable Augmentations. |
Methods Summary |
---|
protected org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Dispatcher | createContentDispatcher()Creates a content dispatcher.
return new FragmentContentDispatcher();
|
public void | endEntity(java.lang.String name, org.apache.xerces.xni.Augmentations augs)This method notifies the end of an entity. The DTD has the pseudo-name
of "[dtd]" parameter entity names start with '%'; and general entities
are just specified by their name.
// flush possible pending output buffer - see scanContent
if (fInScanContent && fStringBuffer.length != 0
&& fDocumentHandler != null) {
fDocumentHandler.characters(fStringBuffer, null);
fStringBuffer.length = 0; // make sure we know it's been flushed
}
super.endEntity(name, augs);
// make sure markup is properly balanced
if (fMarkupDepth != fEntityStack[fEntityDepth]) {
reportFatalError("MarkupEntityMismatch", null);
}
// call handler
if (fDocumentHandler != null && !fScanningAttribute) {
if (!name.equals("[xml]")) {
fDocumentHandler.endGeneralEntity(name, augs);
}
}
|
public java.lang.String | getDispatcherName(org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Dispatcher dispatcher)Returns the dispatcher name.
if (DEBUG_DISPATCHER) {
if (dispatcher != null) {
String name = dispatcher.getClass().getName();
int index = name.lastIndexOf('.");
if (index != -1) {
name = name.substring(index + 1);
index = name.lastIndexOf('$");
if (index != -1) {
name = name.substring(index + 1);
}
}
return name;
}
}
return "null";
|
public org.apache.xerces.xni.XMLDocumentHandler | getDocumentHandler()Returns the document handler
return fDocumentHandler;
|
public java.lang.Boolean | getFeatureDefault(java.lang.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.
for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
if (RECOGNIZED_FEATURES[i].equals(featureId)) {
return FEATURE_DEFAULTS[i];
}
}
return null;
|
public java.lang.Object | getPropertyDefault(java.lang.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.
for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
return PROPERTY_DEFAULTS[i];
}
}
return null;
|
public java.lang.String[] | getRecognizedFeatures()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.
return (String[])(RECOGNIZED_FEATURES.clone());
|
public java.lang.String[] | getRecognizedProperties()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.
return (String[])(RECOGNIZED_PROPERTIES.clone());
|
protected java.lang.String | getScannerStateName(int state)Returns the scanner state name.
switch (state) {
case SCANNER_STATE_DOCTYPE: return "SCANNER_STATE_DOCTYPE";
case SCANNER_STATE_ROOT_ELEMENT: return "SCANNER_STATE_ROOT_ELEMENT";
case SCANNER_STATE_START_OF_MARKUP: return "SCANNER_STATE_START_OF_MARKUP";
case SCANNER_STATE_COMMENT: return "SCANNER_STATE_COMMENT";
case SCANNER_STATE_PI: return "SCANNER_STATE_PI";
case SCANNER_STATE_CONTENT: return "SCANNER_STATE_CONTENT";
case SCANNER_STATE_REFERENCE: return "SCANNER_STATE_REFERENCE";
case SCANNER_STATE_END_OF_INPUT: return "SCANNER_STATE_END_OF_INPUT";
case SCANNER_STATE_TERMINATED: return "SCANNER_STATE_TERMINATED";
case SCANNER_STATE_CDATA: return "SCANNER_STATE_CDATA";
case SCANNER_STATE_TEXT_DECL: return "SCANNER_STATE_TEXT_DECL";
}
return "??? ("+state+')";
|
private void | handleCharacter(char c, java.lang.String entity)Calls document handler with a single character resulting from
built-in entity resolution.
if (fDocumentHandler != null) {
if (fNotifyBuiltInRefs) {
fDocumentHandler.startGeneralEntity(entity, null, null, null);
}
fSingleChar[0] = c;
fTempString.setValues(fSingleChar, 0, 1);
fDocumentHandler.characters(fTempString, null);
if (fNotifyBuiltInRefs) {
fDocumentHandler.endGeneralEntity(entity, null);
}
}
|
protected int | handleEndElement(org.apache.xerces.xni.QName element, boolean isEmpty)Handles the end element. This method will make sure that
the end element name matches the current element and notify
the handler about the end of the element and the end of any
relevent prefix mappings.
Note: This method uses the fQName variable.
The contents of this variable will be destroyed.
fMarkupDepth--;
// check that this element was opened in the same entity
if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) {
reportFatalError("ElementEntityMismatch",
new Object[]{fCurrentElement.rawname});
}
// make sure the elements match
QName startElement = fQName;
fElementStack.popElement(startElement);
if (element.rawname != startElement.rawname) {
reportFatalError("ETagRequired",
new Object[]{startElement.rawname});
}
// bind namespaces
if (fNamespaces) {
element.uri = startElement.uri;
}
// call handler
if (fDocumentHandler != null && !isEmpty) {
fDocumentHandler.endElement(element, null);
}
return fMarkupDepth;
|
public void | reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)Resets the component. The component can query the component manager
about any features and properties that affect the operation of the
component.
super.reset(componentManager);
// other settings
//fDocumentSystemId = null;
// sax features
fAttributes.setNamespaces(fNamespaces);
// initialize vars
fMarkupDepth = 0;
fCurrentElement = null;
fElementStack.clear();
fHasExternalDTD = false;
fStandalone = false;
fIsEntityDeclaredVC = false;
fInScanContent = false;
// setup dispatcher
setScannerState(SCANNER_STATE_CONTENT);
setDispatcher(fContentDispatcher);
if (fParserSettings) {
// parser settings have changed. reset them.
// xerces features
try {
fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS);
} catch (XMLConfigurationException e) {
fNotifyBuiltInRefs = false;
}
// xerces properties
try {
Object resolver = componentManager.getProperty(ENTITY_RESOLVER);
fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
(ExternalSubsetResolver) resolver : null;
}
catch (XMLConfigurationException e) {
fExternalSubsetResolver = null;
}
}
|
protected void | scanAttribute(org.apache.xerces.xni.XMLAttributes 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.
if (DEBUG_CONTENT_SCANNING) System.out.println(">>> scanAttribute()");
// name
if (fNamespaces) {
fEntityScanner.scanQName(fAttributeQName);
}
else {
String name = fEntityScanner.scanName();
fAttributeQName.setValues(null, name, name, null);
}
// equals
fEntityScanner.skipSpaces();
if (!fEntityScanner.skipChar('=")) {
reportFatalError("EqRequiredInAttribute",
new Object[]{fCurrentElement.rawname,fAttributeQName.rawname});
}
fEntityScanner.skipSpaces();
// content
int oldLen = attributes.getLength();
int attrIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null);
// WFC: Unique Att Spec
if (oldLen == attributes.getLength()) {
reportFatalError("AttributeNotUnique",
new Object[]{fCurrentElement.rawname,
fAttributeQName.rawname});
}
// Scan attribute value and return true if the un-normalized and normalized value are the same
boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2,
fAttributeQName.rawname, fIsEntityDeclaredVC, fCurrentElement.rawname);
attributes.setValue(attrIndex, fTempString.toString());
// If the non-normalized and normalized value are the same, avoid creating a new string.
if (!isSameNormalizedAttr) {
attributes.setNonNormalizedValue(attrIndex, fTempString2.toString());
}
attributes.setSpecified(attrIndex, true);
if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanAttribute()");
|
protected boolean | scanCDATASection(boolean complete)Scans a CDATA section.
Note: This method uses the fTempString and
fStringBuffer variables.
// call handler
if (fDocumentHandler != null) {
fDocumentHandler.startCDATA(null);
}
while (true) {
fStringBuffer.clear();
if (!fEntityScanner.scanData("]]", fStringBuffer)) {
if (fDocumentHandler != null && fStringBuffer.length > 0) {
fDocumentHandler.characters(fStringBuffer, null);
}
int brackets = 0;
while (fEntityScanner.skipChar(']")) {
brackets++;
}
if (fDocumentHandler != null && brackets > 0) {
fStringBuffer.clear();
if (brackets > XMLEntityManager.DEFAULT_BUFFER_SIZE) {
// Handle large sequences of ']'
int chunks = brackets / XMLEntityManager.DEFAULT_BUFFER_SIZE;
int remainder = brackets % XMLEntityManager.DEFAULT_BUFFER_SIZE;
for (int i = 0; i < XMLEntityManager.DEFAULT_BUFFER_SIZE; i++) {
fStringBuffer.append(']");
}
for (int i = 0; i < chunks; i++) {
fDocumentHandler.characters(fStringBuffer, null);
}
if (remainder != 0) {
fStringBuffer.length = remainder;
fDocumentHandler.characters(fStringBuffer, null);
}
}
else {
for (int i = 0; i < brackets; i++) {
fStringBuffer.append(']");
}
fDocumentHandler.characters(fStringBuffer, null);
}
}
if (fEntityScanner.skipChar('>")) {
break;
}
if (fDocumentHandler != null) {
fStringBuffer.clear();
fStringBuffer.append("]]");
fDocumentHandler.characters(fStringBuffer, null);
}
}
else {
if (fDocumentHandler != null) {
fDocumentHandler.characters(fStringBuffer, null);
}
int c = fEntityScanner.peekChar();
if (c != -1 && isInvalidLiteral(c)) {
if (XMLChar.isHighSurrogate(c)) {
fStringBuffer.clear();
scanSurrogates(fStringBuffer);
if (fDocumentHandler != null) {
fDocumentHandler.characters(fStringBuffer, null);
}
}
else {
reportFatalError("InvalidCharInCDSect",
new Object[]{Integer.toString(c,16)});
fEntityScanner.scanChar();
}
}
}
}
fMarkupDepth--;
// call handler
if (fDocumentHandler != null) {
fDocumentHandler.endCDATA(null);
}
return true;
|
protected void | scanCharReference()Scans a character reference.
[66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
fStringBuffer2.clear();
int ch = scanCharReferenceValue(fStringBuffer2, null);
fMarkupDepth--;
if (ch != -1) {
// call handler
if (fDocumentHandler != null) {
if (fNotifyCharRefs) {
fDocumentHandler.startGeneralEntity(fCharRefLiteral, null, null, null);
}
Augmentations augs = null;
if (fValidation && ch <= 0x20) {
if (fTempAugmentations != null) {
fTempAugmentations.removeAllItems();
}
else {
fTempAugmentations = new AugmentationsImpl();
}
augs = fTempAugmentations;
augs.putItem(Constants.CHAR_REF_PROBABLE_WS, Boolean.TRUE);
}
fDocumentHandler.characters(fStringBuffer2, augs);
if (fNotifyCharRefs) {
fDocumentHandler.endGeneralEntity(fCharRefLiteral, null);
}
}
}
|
protected void | scanComment()Scans a comment.
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--'
scanComment(fStringBuffer);
fMarkupDepth--;
// call handler
if (fDocumentHandler != null) {
fDocumentHandler.comment(fStringBuffer, null);
}
|
protected int | scanContent()Scans element content.
XMLString content = fTempString;
int c = fEntityScanner.scanContent(content);
if (c == '\r") {
// happens when there is the character reference
fEntityScanner.scanChar();
fStringBuffer.clear();
fStringBuffer.append(fTempString);
fStringBuffer.append((char)c);
content = fStringBuffer;
c = -1;
}
if (fDocumentHandler != null && content.length > 0) {
fDocumentHandler.characters(content, null);
}
if (c == ']" && fTempString.length == 0) {
fStringBuffer.clear();
fStringBuffer.append((char)fEntityScanner.scanChar());
// remember where we are in case we get an endEntity before we
// could flush the buffer out - this happens when we're parsing an
// entity which ends with a ]
fInScanContent = true;
//
// We work on a single character basis to handle cases such as:
// ']]]>' which we might otherwise miss.
//
if (fEntityScanner.skipChar(']")) {
fStringBuffer.append(']");
while (fEntityScanner.skipChar(']")) {
fStringBuffer.append(']");
}
if (fEntityScanner.skipChar('>")) {
reportFatalError("CDEndInContent", null);
}
}
if (fDocumentHandler != null && fStringBuffer.length != 0) {
fDocumentHandler.characters(fStringBuffer, null);
}
fInScanContent = false;
c = -1;
}
return c;
|
public boolean | scanDocument(boolean complete)Scans a document.
// reset entity scanner
fEntityScanner = fEntityManager.getEntityScanner();
// keep dispatching "events"
fEntityManager.setEntityHandler(this);
do {
if (!fDispatcher.dispatch(complete)) {
return false;
}
} while (complete);
// return success
return true;
|
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.
if (DEBUG_CONTENT_SCANNING) System.out.println(">>> scanEndElement()");
fElementStack.popElement(fElementQName) ;
// Take advantage of the fact that next string _should_ be "fElementQName.rawName",
//In scanners most of the time is consumed on checks done for XML characters, we can
// optimize on it and avoid the checks done for endElement,
//we will also avoid symbol table lookup - neeraj.bajaj@sun.com
// this should work both for namespace processing true or false...
//REVISIT: if the string is not the same as expected.. we need to do better error handling..
//We can skip this for now... In any case if the string doesn't match -- document is not well formed.
if (!fEntityScanner.skipString(fElementQName.rawname)) {
reportFatalError("ETagRequired", new Object[]{fElementQName.rawname});
}
// end
fEntityScanner.skipSpaces();
if (!fEntityScanner.skipChar('>")) {
reportFatalError("ETagUnterminated",
new Object[]{fElementQName.rawname});
}
fMarkupDepth--;
//we have increased the depth for two markup "<" characters
fMarkupDepth--;
// check that this element was opened in the same entity
if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) {
reportFatalError("ElementEntityMismatch",
new Object[]{fCurrentElement.rawname});
}
// call handler
if (fDocumentHandler != null ) {
fDocumentHandler.endElement(fElementQName, null);
}
return fMarkupDepth;
|
protected void | scanEntityReference()Scans an entity reference.
// name
String name = fEntityScanner.scanName();
if (name == null) {
reportFatalError("NameRequiredInReference", null);
return;
}
// end
if (!fEntityScanner.skipChar(';")) {
reportFatalError("SemicolonRequiredInReference", new Object []{name});
}
fMarkupDepth--;
// handle built-in entities
if (name == fAmpSymbol) {
handleCharacter('&", fAmpSymbol);
}
else if (name == fLtSymbol) {
handleCharacter('<", fLtSymbol);
}
else if (name == fGtSymbol) {
handleCharacter('>", fGtSymbol);
}
else if (name == fQuotSymbol) {
handleCharacter('"", fQuotSymbol);
}
else if (name == fAposSymbol) {
handleCharacter('\'", fAposSymbol);
}
// start general entity
else if (fEntityManager.isUnparsedEntity(name)) {
reportFatalError("ReferenceToUnparsedEntity", new Object[]{name});
}
else {
if (!fEntityManager.isDeclaredEntity(name)) {
if (fIsEntityDeclaredVC) {
if (fValidation)
fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared",
new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR);
}
else {
reportFatalError("EntityNotDeclared", new Object[]{name});
}
}
fEntityManager.startEntity(name, false);
}
|
protected void | scanPIData(java.lang.String target, org.apache.xerces.xni.XMLString data)Scans a processing data. This is needed to handle the situation
where a document starts with a processing instruction whose
target name starts with "xml". (e.g. xmlfoo)
super.scanPIData(target, data);
fMarkupDepth--;
// call handler
if (fDocumentHandler != null) {
fDocumentHandler.processingInstruction(target, data, null);
}
|
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.
if (DEBUG_CONTENT_SCANNING) System.out.println(">>> scanStartElement()");
// name
if (fNamespaces) {
fEntityScanner.scanQName(fElementQName);
}
else {
String name = fEntityScanner.scanName();
fElementQName.setValues(null, name, name, null);
}
String rawname = fElementQName.rawname;
// push element stack
fCurrentElement = fElementStack.pushElement(fElementQName);
// attributes
boolean empty = false;
fAttributes.removeAllAttributes();
do {
// spaces
boolean sawSpace = fEntityScanner.skipSpaces();
// end tag?
int c = fEntityScanner.peekChar();
if (c == '>") {
fEntityScanner.scanChar();
break;
}
else if (c == '/") {
fEntityScanner.scanChar();
if (!fEntityScanner.skipChar('>")) {
reportFatalError("ElementUnterminated",
new Object[]{rawname});
}
empty = true;
break;
}
else if (!isValidNameStartChar(c) || !sawSpace) {
// Second chance. Check if this character is a high
// surrogate of a valid name start character.
if (!isValidNameStartHighSurrogate(c) || !sawSpace) {
reportFatalError("ElementUnterminated",
new Object[] { rawname });
}
}
// attributes
scanAttribute(fAttributes);
} while (true);
// call handler
if (fDocumentHandler != null) {
if (empty) {
//decrease the markup depth..
fMarkupDepth--;
// check that this element was opened in the same entity
if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) {
reportFatalError("ElementEntityMismatch",
new Object[]{fCurrentElement.rawname});
}
fDocumentHandler.emptyElement(fElementQName, fAttributes, null);
//pop the element off the stack..
fElementStack.popElement(fElementQName);
}
else {
fDocumentHandler.startElement(fElementQName, fAttributes, null);
}
}
if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanStartElement(): "+empty);
return empty;
|
protected boolean | scanStartElementAfterName()Scans the remainder of a start or empty tag after the element name.
String rawname = fElementQName.rawname;
// push element stack
fCurrentElement = fElementStack.pushElement(fElementQName);
// attributes
boolean empty = false;
fAttributes.removeAllAttributes();
do {
// end tag?
int c = fEntityScanner.peekChar();
if (c == '>") {
fEntityScanner.scanChar();
break;
}
else if (c == '/") {
fEntityScanner.scanChar();
if (!fEntityScanner.skipChar('>")) {
reportFatalError("ElementUnterminated",
new Object[]{rawname});
}
empty = true;
break;
}
else if (!isValidNameStartChar(c) || !fSawSpace) {
// Second chance. Check if this character is a high
// surrogate of a valid name start character.
if (!isValidNameStartHighSurrogate(c) || !fSawSpace) {
reportFatalError("ElementUnterminated",
new Object[] { rawname });
}
}
// attributes
scanAttribute(fAttributes);
// spaces
fSawSpace = fEntityScanner.skipSpaces();
} while (true);
// call handler
if (fDocumentHandler != null) {
if (empty) {
//decrease the markup depth..
fMarkupDepth--;
// check that this element was opened in the same entity
if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) {
reportFatalError("ElementEntityMismatch",
new Object[]{fCurrentElement.rawname});
}
fDocumentHandler.emptyElement(fElementQName, fAttributes, null);
//pop the element off the stack..
fElementStack.popElement(fElementQName);
}
else {
fDocumentHandler.startElement(fElementQName, fAttributes, null);
}
}
if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanStartElementAfterName(): "+empty);
return empty;
|
protected void | scanStartElementName()Scans the name of an element in a start or empty tag.
// name
if (fNamespaces) {
fEntityScanner.scanQName(fElementQName);
}
else {
String name = fEntityScanner.scanName();
fElementQName.setValues(null, name, name, null);
}
// Must skip spaces here because the DTD scanner
// would consume them at the end of the external subset.
fSawSpace = fEntityScanner.skipSpaces();
|
protected void | scanXMLDeclOrTextDecl(boolean scanningTextDecl)Scans an XML or text declaration.
[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
[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 ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
// scan decl
super.scanXMLDeclOrTextDecl(scanningTextDecl, fStrings);
fMarkupDepth--;
// pseudo-attribute values
String version = fStrings[0];
String encoding = fStrings[1];
String standalone = fStrings[2];
// set standalone
fStandalone = standalone != null && standalone.equals("yes");
fEntityManager.setStandalone(fStandalone);
// set version on reader
fEntityScanner.setXMLVersion(version);
// call handler
if (fDocumentHandler != null) {
if (scanningTextDecl) {
fDocumentHandler.textDecl(version, encoding, null);
}
else {
fDocumentHandler.xmlDecl(version, encoding, standalone, null);
}
}
// set encoding on reader
if (encoding != null && !fEntityScanner.fCurrentEntity.isEncodingExternallySpecified()) {
fEntityScanner.setEncoding(encoding);
}
|
protected final void | setDispatcher(org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Dispatcher dispatcher)Sets the dispatcher.
fDispatcher = dispatcher;
if (DEBUG_DISPATCHER) {
System.out.print("%%% setDispatcher: ");
System.out.print(getDispatcherName(dispatcher));
System.out.println();
}
|
public void | setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)setDocumentHandler
fDocumentHandler = documentHandler;
|
public void | setFeature(java.lang.String featureId, boolean state)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.
super.setFeature(featureId, state);
// Xerces properties
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
if (suffixLength == Constants.NOTIFY_BUILTIN_REFS_FEATURE.length() &&
featureId.endsWith(Constants.NOTIFY_BUILTIN_REFS_FEATURE)) {
fNotifyBuiltInRefs = state;
}
}
|
public void | setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)Sets the input source.
fEntityManager.setEntityHandler(this);
fEntityManager.startEntity("$fragment$", inputSource, false, true);
//fDocumentSystemId = fEntityManager.expandSystemId(inputSource.getSystemId());
|
public void | setProperty(java.lang.String propertyId, java.lang.Object value)Sets the value of a property. This method is called by the component
manager any time after reset when a property changes value.
Note: Components should silently ignore properties
that do not affect the operation of the component.
super.setProperty(propertyId, value);
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
if (suffixLength == Constants.ENTITY_MANAGER_PROPERTY.length() &&
propertyId.endsWith(Constants.ENTITY_MANAGER_PROPERTY)) {
fEntityManager = (XMLEntityManager)value;
return;
}
if (suffixLength == Constants.ENTITY_RESOLVER_PROPERTY.length() &&
propertyId.endsWith(Constants.ENTITY_RESOLVER_PROPERTY)) {
fExternalSubsetResolver = (value instanceof ExternalSubsetResolver) ?
(ExternalSubsetResolver) value : null;
return;
}
}
|
protected final void | setScannerState(int state)Sets the scanner state.
fScannerState = state;
if (DEBUG_SCANNER_STATE) {
System.out.print("### setScannerState: ");
System.out.print(getScannerStateName(state));
System.out.println();
}
|
public void | startEntity(java.lang.String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs)This method notifies of the start of an entity. The DTD has the
pseudo-name of "[dtd]" parameter entity names start with '%'; and
general entities are just specified by their name.
// keep track of this entity before fEntityDepth is increased
if (fEntityDepth == fEntityStack.length) {
int[] entityarray = new int[fEntityStack.length * 2];
System.arraycopy(fEntityStack, 0, entityarray, 0, fEntityStack.length);
fEntityStack = entityarray;
}
fEntityStack[fEntityDepth] = fMarkupDepth;
super.startEntity(name, identifier, encoding, augs);
// WFC: entity declared in external subset in standalone doc
if(fStandalone && fEntityManager.isEntityDeclInExternalSubset(name)) {
reportFatalError("MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",
new Object[]{name});
}
// call handler
if (fDocumentHandler != null && !fScanningAttribute) {
if (!name.equals("[xml]")) {
fDocumentHandler.startGeneralEntity(name, identifier, encoding, augs);
}
}
|