Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xerces.parsers
Class DOMParserImpl

    java.lang.Object
      |
      +--org.apache.xerces.parsers.XMLParser
            |
            +--org.apache.xerces.parsers.AbstractXMLDocumentParser
                  |
                  +--org.apache.xerces.parsers.AbstractDOMParser
                        |
                        +--org.apache.xerces.parsers.DOMParserImpl

All Implemented Interfaces:
  org.apache.xerces.dom3.DOMConfiguration, org.w3c.dom.ls.LSParser, org.apache.xerces.xni.XMLDocumentHandler, org.apache.xerces.xni.XMLDTDContentModelHandler, org.apache.xerces.xni.XMLDTDHandler

Direct Known Subclasses:
  DOMASBuilderImpl

public class DOMParserImpl
extends AbstractDOMParser
implements org.w3c.dom.ls.LSParser, org.apache.xerces.dom3.DOMConfiguration

This is Xerces DOM Builder class. It uses the abstract DOM parser with a document scanner, a dtd scanner, and a validator, as well as a grammar pool.

Version:
  $Id: DOMParserImpl.java,v 1.16 2004/02/17 07:14:49 neeraj Exp $
Author:
  Pavani Mukthipudi, Sun Microsystems Inc., Elena Litani, IBM, Rahul Srivastava, Sun Microsystems Inc.

Field Summary
`protected static boolean` | `DEBUG`
`protected static java.lang.String` | `DISALLOW_DOCTYPE_DECL_FEATURE` Feature identifier: disallow docType Decls.
`protected static java.lang.String` | `DYNAMIC_VALIDATION` Dynamic validation
`protected boolean` | `fBusy`
`protected java.lang.String` | `fSchemaType`
`protected static java.lang.String` | `NAMESPACES` Feature identifier: namespaces.
`protected static java.lang.String` | `NORMALIZE_DATA` Feature identifier: expose schema normalized value
`protected static java.lang.String` | `PSVI_AUGMENT`
`protected static java.lang.String` | `SYMBOL_TABLE`
`protected static java.lang.String` | `VALIDATION_FEATURE` Feature id: validation.
`protected static java.lang.String` | `XMLSCHEMA` XML Schema validation

Fields inherited from class org.apache.xerces.parsers.AbstractDOMParser
`abort, CORE_DOCUMENT_CLASS_NAME, CREATE_CDATA_NODES_FEATURE, CREATE_ENTITY_REF_NODES, CURRENT_ELEMENT_NODE, DEFAULT_DOCUMENT_CLASS_NAME, DEFER_NODE_EXPANSION, DOCUMENT_CLASS_NAME, fBaseURIStack, fCreateCDATANodes, fCreateEntityRefNodes, fCurrentCDATASection, fCurrentCDATASectionIndex, fCurrentEntityDecl, fCurrentNode, fCurrentNodeIndex, fDeferNodeExpansion, fDeferredDocumentImpl, fDeferredEntityDecl, fDocument, fDocumentClassName, fDocumentImpl, fDocumentIndex, fDocumentType, fDocumentTypeIndex, fDOMFilter, fErrorHandler, fFilterReject, fFirstChunk, fInCDATASection, fIncludeComments, fIncludeIgnorableWhitespace, fInDTD, fInDTDExternalSubset, fInEntityRef, fInternalSubset, fNamespaceAware, fRejectedElement, fRoot, fSkippedElemStack, fStorePSVI, fStringBuffer, INCLUDE_COMMENTS_FEATURE, INCLUDE_IGNORABLE_WHITESPACE, PSVI_DOCUMENT_CLASS_NAME`

Fields inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
`fDocumentSource, fDTDContentModelSource, fDTDSource`

Fields inherited from class org.apache.xerces.parsers.XMLParser
`ENTITY_RESOLVER, ERROR_HANDLER, fConfiguration`

Fields inherited from interface org.w3c.dom.ls.LSParser
`ACTION_APPEND_AS_CHILDREN, ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE, ACTION_REPLACE, ACTION_REPLACE_CHILDREN`

Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler
`CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE`

Fields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
`OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE`

Constructor Summary
`DOMParserImpl(java.lang.String configuration, java.lang.String schemaType)` Constructs a DOM Builder using the standard parser configuration.
`DOMParserImpl(SymbolTable symbolTable)` Constructs a DOM Builder using the specified symbol table.
`DOMParserImpl(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)` Constructs a DOM Builder using the specified symbol table and grammar pool.
`DOMParserImpl(org.apache.xerces.xni.parser.XMLParserConfiguration config)` Constructs a DOM Builder using the specified parser configuration.

Method Summary
`void` | `abort()` Abort the loading of the document that is currently being loaded by the `LSParser`.
`boolean` | `canSetParameter(java.lang.String name, java.lang.Object value)` Check if setting a parameter to a specific value is supported.
`boolean` | `getAsync()` `true` if the `LSParser` is asynchronous, `false` if it is synchronous.
`boolean` | `getBusy()` `true` if the `LSParser` is currently busy loading a document, otherwise `false`.
`org.apache.xerces.dom3.DOMConfiguration` | `getDomConfig()` The `DOMConfiguration` object used when parsing an input source.
`org.w3c.dom.ls.LSParserFilter` | `getFilter()` When the application provides a filter, the parser will call out to the filter at the completion of the construction of each `Element` node.
`java.lang.Object` | `getParameter(java.lang.String name)` Look up the value of a feature or a property.
`org.apache.xerces.dom3.DOMStringList` | `getParameterNames()` DOM Level 3 CR - Experimental.
`org.w3c.dom.Document` | `parse(org.w3c.dom.ls.LSInput is)` Parse an XML document from a resource identified by an `LSInput`.
`org.w3c.dom.Document` | `parseURI(java.lang.String uri)` Parse an XML document from a location identified by an URI reference.
`org.w3c.dom.Node` | `parseWithContext(org.w3c.dom.ls.LSInput is, org.w3c.dom.Node cnode, short action)` Parse an XML document or fragment from a resource identified by an `LSInput` and insert the content into an existing document at the position epcified with the `contextNode` and `action` arguments.
`void` | `reset()` Resets the parser state.
`void` | `setFilter(org.w3c.dom.ls.LSParserFilter filter)` When the application provides a filter, the parser will call out to the filter at the completion of the construction of each `Element` node.
`void` | `setParameter(java.lang.String name, java.lang.Object value)` Set parameters and properties

Methods inherited from class org.apache.xerces.parsers.AbstractDOMParser
`attributeDecl, characters, comment, createAttrNode, createElementNode, doctypeDecl, elementDecl, emptyElement, endAttlist, endCDATA, endConditional, endDocument, endDTD, endElement, endExternalSubset, endGeneralEntity, endParameterEntity, externalEntityDecl, getDocument, getDocumentClassName, handleBaseURI, handleBaseURI, ignorableWhitespace, ignoredCharacters, internalEntityDecl, notationDecl, processingInstruction, setCharacterData, setDocumentClassName, setLocale, startAttlist, startCDATA, startConditional, startDocument, startDTD, startElement, startExternalSubset, startGeneralEntity, startParameterEntity, textDecl, unparsedEntityDecl, xmlDecl`

Methods inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
`any, element, empty, endContentModel, endGroup, getDocumentSource, getDTDContentModelSource, getDTDSource, occurrence, pcdata, separator, setDocumentSource, setDTDContentModelSource, setDTDSource, startContentModel, startGroup`

Methods inherited from class org.apache.xerces.parsers.XMLParser
`parse`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NAMESPACES

    protected static final java.lang.String NAMESPACES

  Feature identifier: namespaces.

### VALIDATION_FEATURE

    protected static final java.lang.String VALIDATION_FEATURE

  Feature id: validation.

### XMLSCHEMA

    protected static final java.lang.String XMLSCHEMA

  XML Schema validation

### DYNAMIC_VALIDATION

    protected static final java.lang.String DYNAMIC_VALIDATION

  Dynamic validation

### NORMALIZE_DATA

    protected static final java.lang.String NORMALIZE_DATA

  Feature identifier: expose schema normalized value

### DISALLOW_DOCTYPE_DECL_FEATURE

    protected static final java.lang.String DISALLOW_DOCTYPE_DECL_FEATURE

  Feature identifier: disallow docType Decls.

### SYMBOL_TABLE

    protected static final java.lang.String SYMBOL_TABLE

### PSVI_AUGMENT

    protected static final java.lang.String PSVI_AUGMENT

### fSchemaType

    protected java.lang.String fSchemaType

### fBusy

    protected boolean fBusy

### DEBUG

    protected static final boolean DEBUG

Constructor Detail

### DOMParserImpl

    public DOMParserImpl(java.lang.String configuration,
                         java.lang.String schemaType)

  Constructs a DOM Builder using the standard parser configuration.

### DOMParserImpl

    public DOMParserImpl(org.apache.xerces.xni.parser.XMLParserConfiguration config)

  Constructs a DOM Builder using the specified parser configuration.

### DOMParserImpl

    public DOMParserImpl(SymbolTable symbolTable)

  Constructs a DOM Builder using the specified symbol table.

### DOMParserImpl

    public DOMParserImpl(SymbolTable symbolTable,
                         org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)

  Constructs a DOM Builder using the specified symbol table and grammar pool.

Method Detail

### reset

    public void reset()

  Resets the parser state.
  Overrides:
    `reset` in class `AbstractDOMParser`
  Throws:
    `SAXException` - Thrown on initialization error.

### getDomConfig

    public org.apache.xerces.dom3.DOMConfiguration getDomConfig()

  Description copied from interface: `org.w3c.dom.ls.LSParser`
  The `DOMConfiguration` object used when parsing an input source. This `DOMConfiguration` is specific to the parse operation and no parameter values from this `DOMConfiguration` object are passed automatically to the `DOMConfiguration` object on the `Document` that is created, or used, by the parse operation. The DOM application is responsible for passing any needed parameter values from this `DOMConfiguration` object to the `DOMConfiguration` object referenced by the `Document` object.
  In addition to the parameters recognized in on the DOMConfiguration interface defined in DOM Level 3 Core , the `DOMConfiguration` objects for `LSParser` add or modify the following parameters:
  `"charset-overrides-xml-encoding"`
    `true`
      [optional] (default) If a higher level protocol such as HTTP [IETF RFC 2616] provides an indication of the character encoding of the input stream being processed, that will override any encoding specified in the XML declaration or the Text declaration (see also section 4.3.3, "Character Encoding in Entities", in [XML 1.0]). Explicitly setting an encoding in the `LSInput` overrides any encoding from the protocol.
    `false`
      [required] The parser ignores any character set encoding information from higher-level protocols.
  `"disallow-doctype"`
    `true`
      [optional] Throw a fatal "doctype-not-allowed" error if a doctype node is found while parsing the document. This is useful when dealing with things like SOAP envelopes where doctype nodes are not allowed.
    `false`
      [required] (default) Allow doctype nodes in the document.
  `"ignore-unknown-character-denormalizations"`
    `true`
      [required] (default) If, while verifying full normalization when [XML 1.1] is supported, a processor encounters characters for which it cannot determine the normalization properties, then the processor will ignore any possible denormalizations caused by these characters. This parameter is ignored for [XML 1.0].
    `false`
      [optional] Report an fatal "unknown-character-denormalization" error if a character is encountered for which the processor cannot determine the normalization properties.
  `"infoset"`
    See the definition of `DOMConfiguration` for a description of this parameter. Unlike in [DOM Level 3 Core] , this parameter will default to `true` for `LSParser`.
  `"namespaces"`
    `true`
      [required] (default) Perform the namespace processing as defined in [XML Namespaces] and [XML Namespaces 1.1] .
    `false`
      [optional] Do not perform the namespace processing.
  `"resource-resolver"`
    [required] A reference to a `LSResourceResolver` object, or null. If the value of this parameter is not null when an external resource (such as an external XML entity or an XML schema location) is encountered, the implementation will request that the `LSResourceResolver` referenced in this parameter resolves the resource.
  `"supported-media-types-only"`
    `true`
      [optional] Check that the media type of the parsed resource is a supported media type. If an unsupported media type is encountered, a fatal error of type "unsupported-media-type" will be raised. The media types defined in [IETF RFC 3023] must always be accepted.
    `false`
      [required] (default) Accept any media type.
  The parameter " well-formed" cannot be set to `false`.
  Specified by:
    `getDomConfig` in interface `org.w3c.dom.ls.LSParser`

### getFilter

    public org.w3c.dom.ls.LSParserFilter getFilter()

  When the application provides a filter, the parser will call out to the filter at the completion of the construction of each `Element` node. The filter implementation can choose to remove the element from the document being constructed (unless the element is the document element) or to terminate the parse early. If the document is being validated when it's loaded the validation happens before the filter is called.
  Specified by:
    `getFilter` in interface `org.w3c.dom.ls.LSParser`

### setFilter

    public void setFilter(org.w3c.dom.ls.LSParserFilter filter)

  When the application provides a filter, the parser will call out to the filter at the completion of the construction of each `Element` node. The filter implementation can choose to remove the element from the document being constructed (unless the element is the document element) or to terminate the parse early. If the document is being validated when it's loaded the validation happens before the filter is called.
  Specified by:
    `setFilter` in interface `org.w3c.dom.ls.LSParser`

### setParameter

    public void setParameter(java.lang.String name,
                             java.lang.Object value)
                      throws org.w3c.dom.DOMException

  Set parameters and properties
  Specified by:
    `setParameter` in interface `org.apache.xerces.dom3.DOMConfiguration`
  Following copied from interface: `org.apache.xerces.dom3.DOMConfiguration`
  Parameters:
    `name` - The name of the parameter to set.
    `value` - The new value or `null` if the user wishes to unset the parameter. While the type of the value parameter is defined as `DOMUserData`, the object type must match the type defined by the definition of the parameter. For example, if the parameter is "error-handler", the value must be of type `DOMErrorHandler`.
  Throws:
    `org.w3c.dom.DOMException` - NOT_FOUND_ERR: Raised when the parameter name is not recognized.
    NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but the requested value cannot be set.
    TYPE_MISMATCH_ERR: Raised if the value type for this parameter name is incompatible with the expected value type.

### getParameter

    public java.lang.Object getParameter(java.lang.String name)
                                  throws org.w3c.dom.DOMException

  Look up the value of a feature or a property.
  Specified by:
    `getParameter` in interface `org.apache.xerces.dom3.DOMConfiguration`
  Following copied from interface: `org.apache.xerces.dom3.DOMConfiguration`
  Parameters:
    `name` - The name of the parameter.
  Returns:
    The current object associated with the specified parameter or `null` if no object has been associated or if the parameter is not supported.
  Throws:
    `org.w3c.dom.DOMException` - NOT_FOUND_ERR: Raised when the parameter name is not recognized.

### canSetParameter

    public boolean canSetParameter(java.lang.String name,
                                   java.lang.Object value)

  Description copied from interface: `org.apache.xerces.dom3.DOMConfiguration`
  Check if setting a parameter to a specific value is supported.
  Specified by:
    `canSetParameter` in interface `org.apache.xerces.dom3.DOMConfiguration`
  Following copied from interface: `org.apache.xerces.dom3.DOMConfiguration`
  Parameters:
    `name` - The name of the parameter to check.
    `value` - An object. if `null`, the returned value is `true`.
  Returns:
    `true` if the parameter could be successfully set to the specified value, or `false` if the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself.

### getParameterNames

    public org.apache.xerces.dom3.DOMStringList getParameterNames()

  DOM Level 3 CR - Experimental. The list of the parameters supported by this `DOMConfiguration` object and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.
  Specified by:
    `getParameterNames` in interface `org.apache.xerces.dom3.DOMConfiguration`

### parseURI

    public org.w3c.dom.Document parseURI(java.lang.String uri)
                                  throws org.w3c.dom.ls.LSException

  Parse an XML document from a location identified by an URI reference. If the URI contains a fragment identifier (see section 4.1 in ), the behavior is not defined by this specification.
  Specified by:
    `parseURI` in interface `org.w3c.dom.ls.LSParser`
  Following copied from interface: `org.w3c.dom.ls.LSParser`
  Parameters:
    `uri` - The location of the XML document to be read.
  Returns:
    If the `LSParser` is a synchronous `LSParser`, the newly created and populated `Document` is returned, or `null` if an error occured. If the `LSParser` is asynchronous, `null` is returned since the document object may not yet be constructed when this method returns.
  Throws:
    `org.w3c.dom.DOMException` - INVALID_STATE_ERR: Raised if the `LSParser.busy` attribute is `true`.
    `org.w3c.dom.ls.LSException` - PARSE_ERR: Raised if the `LSParser` was unable to load the XML document. DOM applications should attach a `DOMErrorHandler` using the parameter " error-handler" if they wish to get details on the error.

### parse

    public org.w3c.dom.Document parse(org.w3c.dom.ls.LSInput is)
                               throws org.w3c.dom.ls.LSException

  Parse an XML document from a resource identified by an `LSInput`.
  Specified by:
    `parse` in interface `org.w3c.dom.ls.LSParser`
  Following copied from interface: `org.w3c.dom.ls.LSParser`
  Parameters:
    `input` - The `LSInput` from which the source of the document is to be read.
  Returns:
    If the `LSParser` is a synchronous `LSParser`, the newly created and populated `Document` is returned. If the `LSParser` is asynchronous, `null` is returned since the document object may not yet be constructed when this method returns.
  Throws:
    `org.w3c.dom.DOMException` - INVALID_STATE_ERR: Raised if the `LSParser`'s `LSParser.busy` attribute is `true`.
    `org.w3c.dom.ls.LSException` - PARSE_ERR: Raised if the `LSParser` was unable to load the XML document. DOM applications should attach a `DOMErrorHandler` using the parameter " error-handler" if they wish to get details on the error.

### parseWithContext

    public org.w3c.dom.Node parseWithContext(org.w3c.dom.ls.LSInput is,
                                             org.w3c.dom.Node cnode,
                                             short action)
                                      throws org.w3c.dom.DOMException,
                                             org.w3c.dom.ls.LSException

  Parse an XML document or fragment from a resource identified by an `LSInput` and insert the content into an existing document at the position epcified with the `contextNode` and `action` arguments. When parsing the input stream the context node is used for resolving unbound namespace prefixes.
  Specified by:
    `parseWithContext` in interface `org.w3c.dom.ls.LSParser`
  Parameters:
    `is` - The `LSInput` from which the source document is to be read.
    `cnode` - The `Node` that is used as the context for the data that is being parsed.
    `action` - This parameter describes which action should be taken between the new set of node being inserted and the existing children of the context node. The set of possible actions is defined above.
  Throws:
    `org.w3c.dom.DOMException` - HIERARCHY_REQUEST_ERR: Thrown if this action results in an invalid hierarchy (i.e. a Document with more than one document element).

### getAsync

    public boolean getAsync()

  Description copied from interface: `org.w3c.dom.ls.LSParser`
  `true` if the `LSParser` is asynchronous, `false` if it is synchronous.
  Specified by:
    `getAsync` in interface `org.w3c.dom.ls.LSParser`
  See Also:
    `LSParser.getAsync()`

### getBusy

    public boolean getBusy()

  Description copied from interface: `org.w3c.dom.ls.LSParser`
  `true` if the `LSParser` is currently busy loading a document, otherwise `false`.
  Specified by:
    `getBusy` in interface `org.w3c.dom.ls.LSParser`
  See Also:
    `LSParser.getBusy()`

### abort

    public void abort()

  Description copied from interface: `org.w3c.dom.ls.LSParser`
  Abort the loading of the document that is currently being loaded by the `LSParser`. If the `LSParser` is currently not busy, a call to this method does nothing.
  Specified by:
    `abort` in interface `org.w3c.dom.ls.LSParser`
  Overrides:
    `abort` in class `AbstractDOMParser`
  See Also:
    `org.w3c.dom.ls.DOMParser#abort()`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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