/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This is the base class of all DOM parsers. It implements the XNI
* callback methods to create the DOM tree. After a successful parse of
* an XML document, the DOM Document object can be queried using the
* <code>getDocument</code> method. The actual pipeline is defined in
* parser configuration.
*
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
* @author Elena Litani, IBM
*
* @version $Id: AbstractDOMParser.java,v 1.10 2010-11-01 04:40:09 joehw Exp $
*/
//
// Constants
//
// feature ids
/** Feature id: namespace. */
/** Feature id: create entity ref nodes. */
/** Feature id: include comments. */
/** Feature id: create cdata nodes. */
/** Feature id: include ignorable whitespace. */
/** Feature id: defer node expansion. */
/** Recognized features. */
};
// property ids
/** Property id: document class name. */
// protected static final String GRAMMAR_POOL =
// Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
/** Recognized properties. */
};
// other
/** Default document class name. */
"com.sun.org.apache.xerces.internal.dom.DocumentImpl";
"com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl";
"com.sun.org.apache.xerces.internal.dom.PSVIDocumentImpl";
/**
* If the user stops the process, this exception will be thrown.
*/
private Abort() {}
return this;
}
}
// debugging
private static final boolean DEBUG_EVENTS = false;
private static final boolean DEBUG_BASEURI = false;
//
// Data
//
/** DOM L3 error handler */
/** True if inside DTD. */
protected boolean fInDTD;
// features
/** Create entity reference nodes. */
protected boolean fCreateEntityRefNodes;
/** Include ignorable whitespace. */
protected boolean fIncludeIgnorableWhitespace;
/** Include Comments. */
protected boolean fIncludeComments;
/** Create cdata nodes. */
protected boolean fCreateCDATANodes;
// dom information
/** The document. */
/** The default Xerces document implementation, if used. */
/** Whether to store PSVI information in DOM tree. */
protected boolean fStorePSVI;
/** The document class name to use. */
/** The document type node. */
/** Current node. */
protected int fDeferredEntityDecl;
/** Character buffer */
// internal subset
/** Internal subset buffer. */
// deferred expansion data
protected boolean fDeferNodeExpansion;
protected boolean fNamespaceAware;
protected int fDocumentIndex;
protected int fDocumentTypeIndex;
protected int fCurrentNodeIndex;
protected int fCurrentCDATASectionIndex;
// state
/** True if inside DTD external subset. */
protected boolean fInDTDExternalSubset;
/** Root element node. */
/** True if inside CDATA section. */
protected boolean fInCDATASection;
/** True if saw the first chunk of characters*/
protected boolean fFirstChunk = false;
/** LSParserFilter: specifies that element with given QNAME and all its children
* must be rejected */
protected boolean fFilterReject = false;
// data
/** Base uri stack*/
/** LSParserFilter: tracks the element depth within a rejected subtree. */
/** LSParserFilter: store depth of skipped elements */
/** LSParserFilter: true if inside entity reference */
protected boolean fInEntityRef = false;
/** Attribute QName. */
/** Document locator. */
// handlers
//
// Constructors
//
/** Default constructor. */
super (config);
// add recognized features
// set default values
// add recognized properties
// set default values
} // <init>(XMLParserConfiguration)
/**
* This method retrieves the name of current document class.
*/
return fDocumentClassName;
}
/**
* This method allows the programmer to decide which document
* factory to use when constructing the DOM tree. However, doing
* so will lose the functionality of the default factory. Also,
* a document class other than the default will lose the ability
* to defer node expansion on the DOM tree produced.
*
* @param documentClassName The fully qualified class name of the
* document factory to use when constructing
* the DOM tree.
*
* @see #getDocumentClassName
* @see #DEFAULT_DOCUMENT_CLASS_NAME
*/
// normalize class name
if (documentClassName == null) {
}
// verify that this class exists and is of the right type
try {
//if (!_class.isAssignableFrom(Document.class)) {
throw new IllegalArgumentException (
}
}
catch (ClassNotFoundException e) {
throw new IllegalArgumentException (
}
}
// set document class name
fDeferNodeExpansion = false;
}
} // setDocumentClassName(String)
//
// Public methods
//
/** Returns the DOM document object. */
return fDocument;
} // getDocument():Document
/**
* Drops all references to the last DOM which was built by this parser.
*/
public final void dropDocumentReferences() {
fCurrentNode = null;
} // dropDocumentReferences()
//
// XMLDocumentParser methods
//
/**
* Resets the parser state.
*
* @throws SAXException Thrown on initialization error.
*/
super.reset ();
// get feature state
// get property
// reset dom information
fStorePSVI = false;
fDocumentTypeIndex = -1;
fCurrentNode = null;
// reset string buffer
// reset state information
fInDTD = false;
fInDTDExternalSubset = false;
fInCDATASection = false;
fFirstChunk = false;
} // reset()
/**
* Set the locale to use for messages.
*
* @param locale The locale object to use for localization of messages.
*
*/
} // setLocale(Locale)
//
// XMLDocumentHandler methods
//
/**
* This method notifies the start of a general entity.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
* @param name The name of the general entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal entities or a document entity that is
* parsed from a java.io.Reader).
* @param augs Additional information that may include infoset augmentations
*
* @exception XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
// Always create entity reference nodes to be able to recreate
// entity as a part of doctype
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
setCharacterData (true);
if (fDocumentImpl != null) {
// REVISIT: baseURI/actualEncoding
// remove dependency on our implementation when DOM L3 is REC
//
// set base uri
if (fDocumentType != null) {
// set actual encoding
if (fCurrentEntityDecl != null) {
}
}
// we don't need synchronization now, because entity ref will be
// expanded anyway. Synch only needed when user creates entityRef node
erImpl.needsSyncChildren (false);
}
fInEntityRef = true;
fCurrentNode = er;
}
else {
int er =
if (fDocumentTypeIndex != -1) {
// find corresponding Entity decl
while (node != -1) {
break;
}
}
}
}
}
} // startGeneralEntity(String,XMLResourceIdentifier, Augmentations)
/**
* Notifies of the presence of a TextDecl line in an entity. If present,
* this method will be called immediately following the startEntity call.
* <p>
* <strong>Note:</strong> This method will never be called for the
* document entity; it is only called for external general entities
* referenced in document content.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
* @param version The XML version, or null if not specified.
* @param encoding The IANA encoding name of the entity.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (fInDTD){
return;
}
if (!fDeferNodeExpansion) {
}
}
else {
if (fDeferredEntityDecl !=-1) {
}
}
} // textDecl(String,String)
/**
* A comment.
*
* @param text The text in the comment.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by application to signal an error.
*/
if (fInDTD) {
}
}
return;
}
if (!fIncludeComments || fFilterReject) {
return;
}
if (!fDeferNodeExpansion) {
setCharacterData (false);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
}
case LSParserFilter.FILTER_REJECT:{
// REVISIT: the constant FILTER_REJECT should be changed when new
// DOM LS specs gets published
// fall through to SKIP since comment has no children.
}
case LSParserFilter.FILTER_SKIP: {
// REVISIT: the constant FILTER_SKIP should be changed when new
// DOM LS specs gets published
// make sure we don't loose chars if next event is characters()
fFirstChunk = true;
return;
}
default: {
// accept node
}
}
}
}
else {
int comment =
}
} // comment(XMLString)
/**
* A processing instruction. Processing instructions consist of a
* target name and, optionally, text data. The data is only meaningful
* to the application.
* <p>
* Typically, a processing instruction's data will contain a series
* of pseudo-attributes. These pseudo-attributes follow the form of
* element attributes but are <strong>not</strong> parsed or presented
* to the application as anything other than text. The application is
* responsible for parsing the data.
*
* @param target The target.
* @param data The data or null if none specified.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (fInDTD) {
}
}
return;
}
if (DEBUG_EVENTS) {
}
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
setCharacterData (false);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since PI has no children.
}
case LSParserFilter.FILTER_SKIP: {
// fFirstChunk must be set to true so that data
// won't be lost in the case where the child before PI is
// a text node and the next event is characters.
fFirstChunk = true;
return;
}
default: {
}
}
}
}
else {
int pi = fDeferredDocumentImpl.
}
} // processingInstruction(String,XMLString)
/**
* The start of the document.
*
* @param locator The system identifier of the entity if the entity
* is external, null otherwise.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal entities or a document entity that is
* parsed from a java.io.Reader).
* @param namespaceContext
* The namespace context in effect at the
* start of this document.
* This object represents the current context.
* Implementors of this class are responsible
* for copying the namespace bindings from the
* the current context (and its parent contexts)
* if that information is important.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (!fDeferNodeExpansion) {
fDocument = new DocumentImpl ();
// REVISIT: when DOM Level 3 is REC rely on Document.support
// instead of specific class
// set DOM error checking off
fDocumentImpl.setStrictErrorChecking (false);
// set actual encoding
// set documentURI
}
fDocument = new PSVIDocumentImpl();
fStorePSVI = true;
// REVISIT: when DOM Level 3 is REC rely on Document.support
// instead of specific class
// set DOM error checking off
fDocumentImpl.setStrictErrorChecking (false);
// set actual encoding
// set documentURI
}
else {
// use specified document class
try {
// if subclass of our own class that's cool too
fStorePSVI = true;
}
// REVISIT: when DOM Level 3 is REC rely on
// Document.support instead of specific class
// set DOM error checking off
fDocumentImpl.setStrictErrorChecking (false);
// set actual encoding
// set documentURI
}
}
}
catch (ClassNotFoundException e) {
// won't happen we already checked that earlier
}
catch (Exception e) {
throw new RuntimeException (
"CannotCreateDocumentClass",
new Object [] {fDocumentClassName}));
}
}
}
else {
// REVISIT: strict error checking is not implemented in deferred dom.
// Document.support instead of specific class
// set actual encoding
// set documentURI
}
} // startDocument(String,String)
/**
* Notifies of the presence of an XMLDecl line in the document. If
* present, this method will be called immediately following the
* startDocument call.
*
* @param version The XML version.
* @param encoding The IANA encoding name of the document, or null if
* not specified.
* @param standalone The standalone value, or null if not specified.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (!fDeferNodeExpansion) {
// REVISIT: when DOM Level 3 is REC rely on Document.support
// instead of specific class
if (fDocumentImpl != null) {
}
}
else {
}
} // xmlDecl(String,String,String)
/**
* Notifies of the presence of the DOCTYPE line in the document.
*
* @param rootElement The name of the root element.
* @param publicId The public identifier if an external DTD or null
* if the external DTD is specified using SYSTEM.
* @param systemId The system identifier if an external DTD, null
* otherwise.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (!fDeferNodeExpansion) {
if (fDocumentImpl != null) {
}
}
else {
}
} // doctypeDecl(String,String,String)
/**
* The start of an element. If the document specifies the start element
* by using an empty tag, then the startElement method will immediately
* be followed by the endElement method, with no intervening methods.
*
* @param element The name of the element.
* @param attributes The element attributes.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (DEBUG_EVENTS) {
}
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
boolean seenSchemaDefault = false;
for (int i = 0; i < attrCount; i++) {
AttributePSVI attrPSVI =(AttributePSVI) attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI);
}
// Take special care of schema defaulted attributes. Calling the
// non-namespace aware setAttributeNode() method could overwrite
// another attribute with the same local name.
seenSchemaDefault = true;
}
else {
}
// NOTE: The specified value MUST be set after you set
// the node value because that turns the "specified"
// flag to "true" which may overwrite a "false"
// value from the attribute list. -Ac
if (fDocumentImpl != null) {
boolean id = false;
// REVISIT: currently it is possible that someone turns off
// namespaces and turns on xml schema validation
// To avoid classcast exception in AttrImpl check for namespaces
// however the correct solution should probably disallow setting
// namespaces to false when schema processing is turned on.
// XML Schema
}
}
else {
}
}
else {
// DTD
boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED));
// For DOM Level 3 TypeInfo, the type name must
// be null if this attribute has not been declared
// in the DTD.
if (isDeclared) {
}
}
if (id) {
}
// REVISIT: Handle entities in attribute value.
}
}
setCharacterData (false);
}
}
}
// filter nodes
// fill value of the root element
} else {
switch (code) {
case LSParserFilter.FILTER_INTERRUPT :
{
}
case LSParserFilter.FILTER_REJECT :
{
fFilterReject = true;
return;
}
case LSParserFilter.FILTER_SKIP :
{
// make sure that if any char data is available
// the fFirstChunk is true, so that if the next event
// is characters(), and the last node is text, we will copy
// the value already in the text node to fStringBuffer
// (not to lose it).
fFirstChunk = true;
return;
}
default :
{
if (!fSkippedElemStack.isEmpty()) {
}
}
}
}
}
fCurrentNode = el;
}
else {
// Need to loop in reverse order so that the attributes
// are processed in document order when the DOM is expanded.
// set type information
AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI);
boolean id = false;
// REVISIT: currently it is possible that someone turns off
// namespaces and turns on xml schema validation
// To avoid classcast exception in AttrImpl check for namespaces
// however the correct solution should probably disallow setting
// namespaces to false when schema processing is turned on.
// XML Schema
}
}
else {
}
}
else {
// DTD
boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED));
// For DOM Level 3 TypeInfo, the type name must
// be null if this attribute has not been declared
// in the DTD.
if (isDeclared) {
}
}
// create attribute
el,
attributes.getQName (i),
attributes.getURI (i),
attributes.getValue (i),
attributes.isSpecified (i),
id,
type);
}
}
} // startElement(QName,XMLAttributes)
/**
* An empty element.
*
* @param element The name of the element.
* @param attributes The element attributes.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
} // emptyElement(QName,XMLAttributes)
/**
* Character content.
*
* @param text The content.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
}
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
if (fInCDATASection && fCreateCDATANodes) {
if (fCurrentCDATASection == null) {
}
else {
}
}
else if (!fInDTD) {
// if type is union (XML Schema) it is possible that we receive
// character call with empty data
return;
}
// collect all the data into the string buffer.
if (fFirstChunk) {
if (fDocumentImpl != null) {
} else {
}
fFirstChunk = false;
}
}
}
else {
fFirstChunk = true;
}
}
}
else {
// The Text and CDATASection normalization is taken care of within
// the DOM in the deferred case.
if (fInCDATASection && fCreateCDATANodes) {
if (fCurrentCDATASectionIndex == -1) {
int cs = fDeferredDocumentImpl.
}
else {
int txt = fDeferredDocumentImpl.
}
} else if (!fInDTD) {
// if type is union (XML Schema) it is possible that we receive
// character call with empty data
return;
}
int txt = fDeferredDocumentImpl.
createDeferredTextNode (value, false);
}
}
} // characters(XMLString)
/**
* Ignorable whitespace. For this method to be called, the document
* source must have some way of determining that the text containing
* only whitespace characters should be considered ignorable. For
* example, the validator can determine if a length of whitespace
* characters in the document are ignorable based on the element
* content model.
*
* @param text The ignorable whitespace.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (!fIncludeIgnorableWhitespace || fFilterReject) {
return;
}
if (!fDeferNodeExpansion) {
}
else {
if (fDocumentImpl != null) {
textNodeImpl.setIgnorableWhitespace (true);
}
}
}
else {
// The Text normalization is taken care of within the DOM in the
// deferred case.
int txt = fDeferredDocumentImpl.
}
} // ignorableWhitespace(XMLString)
/**
* The end of an element.
*
* @param element The name of the element.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
}
if (!fDeferNodeExpansion) {
// REVISIT: Should this happen after we call the filter?
if (elementPSVI != null) {
// Updating TypeInfo. If the declared type is a union the
// [member type definition] will only be available at the
// end of an element.
if (fNamespaceAware) {
}
}
if (fStorePSVI) {
}
}
}
if (fDOMFilter != null) {
if (fFilterReject) {
if (fRejectedElementDepth-- == 0) {
fFilterReject = false;
}
return;
}
if (!fSkippedElemStack.isEmpty()) {
return;
}
}
setCharacterData (false);
if ((fCurrentNode != fRoot) && !fInEntityRef && (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_ELEMENT)!=0) {
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
}
case LSParserFilter.FILTER_REJECT:{
return;
}
case LSParserFilter.FILTER_SKIP: {
// make sure that if any char data is available
// the fFirstChunk is true, so that if the next event
// is characters(), and the last node is text, we will copy
// the value already in the text node to fStringBuffer
// (not to lose it).
fFirstChunk = true;
// replace children
for (int i=0;i<length;i++) {
}
return;
}
default: { }
}
}
} // end-if DOMFilter
else {
setCharacterData (false);
}
}
else {
if (elementPSVI != null) {
// Setting TypeInfo. If the declared type is a union the
// [member type definition] will only be available at the
// end of an element.
}
}
}
}
} // endElement(QName)
/**
* The start of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
fInCDATASection = true;
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
if (fCreateCDATANodes) {
setCharacterData (false);
}
}
} // startCDATA()
/**
* The end of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
fInCDATASection = false;
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
if (fCurrentCDATASection !=null) {
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since CDATA section has no children.
}
case LSParserFilter.FILTER_SKIP: {
return;
}
default: {
// accept node
}
}
}
}
}
else {
if (fCurrentCDATASectionIndex !=-1) {
}
}
} // endCDATA()
/**
* The end of the document.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (!fDeferNodeExpansion) {
// REVISIT: when DOM Level 3 is REC rely on Document.support
// instead of specific class
// set the actual encoding and set DOM error checking back on
if (fDocumentImpl != null) {
}
fDocumentImpl.setStrictErrorChecking (true);
}
fCurrentNode = null;
}
else {
// set the actual encoding
}
fCurrentNodeIndex = -1;
}
} // endDocument()
/**
* This method notifies the end of a general entity.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
* @param name The name of the entity.
* @param augs Additional information that may include infoset augmentations
*
* @exception XNIException
* Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
}
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
setCharacterData (true);
if (fDocumentType != null) {
// get current entity declaration
if (fCurrentEntityDecl != null) {
fCurrentEntityDecl.setReadOnly (false, true);
}
fCurrentEntityDecl.setReadOnly (true, true);
//entities.setNamedItem(fCurrentEntityDecl);
}
}
}
fInEntityRef = false;
boolean removeEntityRef = false;
if (fCreateEntityRefNodes) {
if (fDocumentImpl != null) {
// Make entity ref node read only
}
if (fDOMFilter !=null &&
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
}
case LSParserFilter.FILTER_REJECT:{
return;
}
case LSParserFilter.FILTER_SKIP: {
// make sure we don't loose chars if next event is characters()
fFirstChunk = true;
removeEntityRef = true;
break;
}
default: {
}
}
} else {
}
}
if (!fCreateEntityRefNodes || removeEntityRef) {
// move entity reference children to the list of
// siblings of its parent and remove entity reference
if (length > 0) {
// get previous sibling of the entity reference
// normalize text nodes
} else {
}
for (int i=1;i <length;i++) {
}
} // length > 0
}
}
else {
if (fDocumentTypeIndex != -1) {
// find corresponding Entity decl
while (node != -1) {
break;
}
}
}
}
if (fDeferredEntityDecl != -1 &&
// entity definition exists and it does not have any children
int prevIndex = -1;
while (childIndex != -1) {
}
}
if (fCreateEntityRefNodes) {
false);
} else { //!fCreateEntityRefNodes
// move children of entity ref before the entity ref.
// remove entity ref.
// holds a child of entity ref
int parentIndex =
false);
int prevIndex = fCurrentNodeIndex;
int lastChild = childIndex;
int sibling = -1;
while (childIndex != -1) {
}
if(lastChild != -1)
else{
}
}
fDeferredEntityDecl = -1;
}
} // endGeneralEntity(String, Augmentations)
/**
* Record baseURI information for the Element (by adding xml:base attribute)
* or for the ProcessingInstruction (by setting a baseURI field)
* Non deferred DOM.
*
* @param node
*/
if (fDocumentImpl != null) {
// REVISIT: remove dependency on our implementation when
// DOM L3 becomes REC
// if an element already has xml:base attribute
// do nothing
if (fNamespaceAware) {
return;
}
return;
}
// retrive the baseURI from the entity reference
if (fNamespaceAware) {
} else {
}
}
}
}
}
}
}
/**
*
* Record baseURI information for the Element (by adding xml:base attribute)
* or for the ProcessingInstruction (by setting a baseURI field)
* Deferred DOM.
*
* @param node
*/
}
"xml:base",
true);
}
}
// retrieve baseURI from the entity reference
// try baseURI of the entity declaration
}
}
}
}
//
// XMLDTDHandler methods
//
/**
* The start of the DTD.
*
* @param locator The document locator, or null if the document
* location cannot be reported during the parsing of
* the document DTD. However, it is <em>strongly</em>
* recommended that a locator be supplied that can
* at least report the base system identifier of the
* DTD.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
fInDTD = true;
}
}
} // startDTD(XMLLocator)
/**
* The end of the DTD.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
}
fInDTD = false;
if (!fBaseURIStack.isEmpty ()) {
fBaseURIStack.pop ();
}
if (fDeferNodeExpansion) {
if (internalSubset != null) {
}
}
else if (fDocumentImpl != null) {
if (internalSubset != null) {
}
}
} // endDTD()
/**
* The start of a conditional section.
*
* @param type The type of the conditional section. This value will
* either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*
* @see #CONDITIONAL_INCLUDE
* @see #CONDITIONAL_IGNORE
*/
} // startConditional(short)
/**
* The end of a conditional section.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
} // endConditional()
/**
* The start of the DTD external subset.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
fInDTDExternalSubset = true;
} // startExternalSubset(Augmentations)
/**
* The end of the DTD external subset.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
fInDTDExternalSubset = false;
fBaseURIStack.pop ();
} // endExternalSubset(Augmentations)
/**
* An internal entity declaration.
*
* @param name The name of the entity. Parameter entity names start with
* '%', whereas the name of a general entity is just the
* entity name.
* @param text The value of the entity.
* @param nonNormalizedText The non-normalized value of the entity. This
* value contains the same sequence of characters that was in
* the internal entity declaration, without any entity
* references expanded.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
// internal subset string
}
else {
}
}
// NOTE: We only know how to create these nodes for the Xerces
// DOM implementation because DOM Level 2 does not specify
// that functionality. -Ac
// create full node
// don't add parameter entities!
return;
if (fDocumentType != null) {
}
}
// create deferred node
if (fDocumentTypeIndex != -1) {
boolean found = false;
while (node != -1) {
found = true;
break;
}
}
}
if (!found) {
int entityIndex =
}
}
} // internalEntityDecl(String,XMLString,XMLString)
/**
* An external entity declaration.
*
* @param name The name of the entity. Parameter entity names start
* with '%', whereas the name of a general entity is just
* the entity name.
* @param identifier An object containing all location information
* pertinent to this notation.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
// internal subset string
}
else {
}
}
else {
}
}
// NOTE: We only know how to create these nodes for the Xerces
// DOM implementation because DOM Level 2 does not specify
// that functionality. -Ac
// create full node
// don't add parameter entities!
return;
if (fDocumentType != null) {
}
}
// create deferred node
if (fDocumentTypeIndex != -1) {
boolean found = false;
while (nodeIndex != -1) {
found = true;
break;
}
}
}
if (!found) {
}
}
} // externalEntityDecl(String,XMLResourceIdentifier, Augmentations)
/**
* This method notifies of the start of a parameter entity. The parameter
* entity name start with a '%' character.
*
* @param name The name of the parameter entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal parameter entities).
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
}
}
/**
* This method notifies the end of a parameter entity. Parameter entity
* names begin with a '%' character.
*
* @param name The name of the parameter entity.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
if (DEBUG_EVENTS) {
}
fBaseURIStack.pop ();
}
/**
* An unparsed entity declaration.
*
* @param name The name of the entity.
* @param identifier An object containing all location information
* pertinent to this entity.
* @param notation The name of the notation.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
if (DEBUG_EVENTS) {
if (DEBUG_BASEURI) {
}
}
// internal subset string
if (literalSystemId != null) {
}
}
else {
}
}
// NOTE: We only know how to create these nodes for the Xerces
// DOM implementation because DOM Level 2 does not specify
// that functionality. -Ac
// create full node
if (fDocumentType != null) {
}
}
// create deferred node
if (fDocumentTypeIndex != -1) {
boolean found = false;
while (nodeIndex != -1) {
found = true;
break;
}
}
}
if (!found) {
}
}
} // unparsedEntityDecl(String,XMLResourceIdentifier, String, Augmentations)
/**
* A notation declaration
*
* @param name The name of the notation.
* @param identifier An object containing all location information
* pertinent to this notation.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
// internal subset string
if (literalSystemId != null) {
}
}
else {
}
}
// NOTE: We only know how to create these nodes for the Xerces
// DOM implementation because DOM Level 2 does not specify
// that functionality. -Ac
// create full node
}
}
// create deferred node
if (fDocumentTypeIndex != -1) {
boolean found = false;
while (nodeIndex != -1) {
found = true;
break;
}
}
}
if (!found) {
}
}
} // notationDecl(String,XMLResourceIdentifier, Augmentations)
/**
* Characters within an IGNORE conditional section.
*
* @param text The ignored text.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
} // ignoredCharacters(XMLString, Augmentations)
/**
* An element declaration.
*
* @param name The name of the element.
* @param contentModel The element content model.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
throws XNIException {
// internal subset string
}
} // elementDecl(String,String)
/**
* An attribute declaration.
*
* @param elementName The name of the element that this attribute
* is associated with.
* @param attributeName The name of the attribute.
* @param type The attribute type. This value will be one of
* the following: "CDATA", "ENTITY", "ENTITIES",
* "ENUMERATION", "ID", "IDREF", "IDREFS",
* "NMTOKEN", "NMTOKENS", or "NOTATION".
* @param enumeration If the type has the value "ENUMERATION" or
* "NOTATION", this array holds the allowed attribute
* values; otherwise, this array is null.
* @param defaultType The attribute default type. This value will be
* one of the following: "#FIXED", "#IMPLIED",
* "#REQUIRED", or null.
* @param defaultValue The attribute default value, or null if no
* default value is specified.
* @param nonNormalizedDefaultValue The attribute default value with no normalization
* performed, or null if no default value is specified.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
// internal subset string
if (i > 0) {
}
}
}
else {
}
if (defaultType != null) {
}
if (defaultValue != null) {
if (c == '\'') {
}
else {
fInternalSubset.append (c);
}
}
}
}
// REVISIT: This code applies to the support of domx/grammar-access
// feature in Xerces 1
// deferred expansion
if (fDeferredDocumentImpl != null) {
// get the default value
if (defaultValue != null) {
// get element definition
// create element definition if not already there
if (elementDefIndex == -1) {
}
// add default attribute
boolean nsEnabled = fNamespaceAware;
if (nsEnabled) {
// DOM Level 2 wants all namespace declaration attributes
// to be bound to "http://www.w3.org/2000/xmlns/"
// So as long as the XML parser doesn't do it, it needs to
// done here.
}
}
}
}
// REVISIT: set ID type correctly
}
} // if deferred
// full expansion
else if (fDocumentImpl != null) {
// get the default value
if (defaultValue != null) {
// get element definition node
if (elementDef == null) {
}
// REVISIT: Check for uniqueness of element name? -Ac
// create attribute and set properties
boolean nsEnabled = fNamespaceAware;
if (nsEnabled) {
// DOM Level 2 wants all namespace declaration attributes
// to be bound to "http://www.w3.org/2000/xmlns/"
// So as long as the XML parser doesn't do it, it needs to
// done here.
}
}
}
else {
}
attr.setSpecified (false);
// add default attribute to element definition
if (nsEnabled){
}
else {
}
}
} // if NOT defer-node-expansion
} // attributeDecl(String,String,String,String[],String,XMLString, XMLString, Augmentations)
/**
* The start of an attribute list.
*
* @param elementName The name of the element that this attribute
* list is associated with.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
} // startAttlist(String)
/**
* The end of an attribute list.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
} // endAttlist()
// method to create an element node.
// subclasses can override this method to create element nodes in other ways.
if (fNamespaceAware) {
// if we are using xerces DOM implementation, call our
// own constructor to reuse the strings we have here.
if (fDocumentImpl != null) {
}
else {
}
}
else {
}
return el;
}
// method to create an attribute node.
// subclasses can override this method to create attribute nodes in other ways.
if (fNamespaceAware) {
if (fDocumentImpl != null) {
// if we are using xerces DOM implementation, call our
// own constructor to reuse the strings we have here.
}
else {
}
}
else {
}
return attr;
}
/*
* When the first characters() call is received, the data is stored in
* a new Text node. If right after the first characters() we receive another chunk of data,
* the data from the Text node, following the new characters are appended
* to the fStringBuffer and the text node data is set to empty.
*
* This function is called when the state is changed and the
* data must be appended to the current node.
*
* Note: if DOMFilter is set, you must make sure that if Node is skipped,
* or removed fFistChunk must be set to true, otherwise some data can be lost.
*
*/
// handle character data
// if we have data in the buffer we must have created
// a text node already.
// REVISIT: should this check be performed?
if (fDocumentImpl != null) {
}
else {
}
}
// reset string buffer
}
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since Comment has no children.
}
case LSParserFilter.FILTER_SKIP: {
return;
}
default: {
// accept node -- do nothing
}
}
}
} // end-if fDOMFilter !=null
} // end-if child !=null
}
/**
* @see org.w3c.dom.ls.LSParser#abort()
*/
public void abort () {
}
} // class AbstractDOMParser