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

## org.apache.xerces.parsers
Class DOMBuilderImpl

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

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

Direct Known Subclasses:
  DOMASBuilderImpl

public class DOMBuilderImpl
extends AbstractDOMParser
implements org.w3c.dom.ls.DOMBuilder, 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: DOMBuilderImpl.java,v 1.31 2003/01/23 19:39:13 neilg 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` | `DYNAMIC_VALIDATION` Dynamic validation
`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
`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, fInDocument, fInDTD, fInDTDExternalSubset, fInternalSubset, fNamespaceAware, fRejectedElement, 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.DOMBuilder
`ACTION_APPEND_AS_CHILDREN, ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE, ACTION_REPLACE`

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
`DOMBuilderImpl(java.lang.String configuration, java.lang.String schemaType)` Constructs a DOM Builder using the standard parser configuration.
`DOMBuilderImpl(SymbolTable symbolTable)` Constructs a DOM Builder using the specified symbol table.
`DOMBuilderImpl(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)` Constructs a DOM Builder using the specified symbol table and grammar pool.
`DOMBuilderImpl(org.apache.xerces.xni.parser.XMLParserConfiguration config)` Constructs a DOM Builder using the specified parser configuration.

Method Summary
`boolean` | `canSetParameter(java.lang.String name, java.lang.Object value)` Check if setting a parameter to a specific value is supported.
`org.apache.xerces.dom3.DOMConfiguration` | `getConfig()` The configuration used when a document is loaded.
`org.w3c.dom.ls.DOMBuilderFilter` | `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.w3c.dom.Document` | `parse(org.w3c.dom.ls.DOMInputSource is)` Parse an XML document from a resource identified by an `DOMInputSource`.
`org.w3c.dom.Document` | `parseURI(java.lang.String uri)` Parse an XML document from a location identified by an URI reference.
`void` | `parseWithContext(org.w3c.dom.ls.DOMInputSource is, org.w3c.dom.Node cnode, short action)` Parse an XML document or fragment from a resource identified by an `DOMInputSource` 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.DOMBuilderFilter 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

### 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

### DEBUG

    protected static final boolean DEBUG

Constructor Detail

### DOMBuilderImpl

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

  Constructs a DOM Builder using the standard parser configuration.

### DOMBuilderImpl

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

  Constructs a DOM Builder using the specified parser configuration.

### DOMBuilderImpl

    public DOMBuilderImpl(SymbolTable symbolTable)

  Constructs a DOM Builder using the specified symbol table.

### DOMBuilderImpl

    public DOMBuilderImpl(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.

### getConfig

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

  Description copied from interface: `org.w3c.dom.ls.DOMBuilder`
  The configuration used when a document is loaded. The values of parameters used to load a document are not passed automatically to the `DOMConfiguration` object used by the `Document` nodes. The DOM application is responsible for passing the parameters values from the `DOMConfiguration` object referenced from `DOMBuilder` to the `DOMConfiguration` object referenced from `Document`.
  In addition to the boolean parameters and parameters recognized in the Core module, the `DOMConfiguration` objects for `DOMBuider` adds the following boolean parameters:
  `"entity-resolver"`
    [required] A `DOMEntityResolver` object. If this parameter has been specified, each time a reference to an external entity is encountered the implementation will pass the public and system IDs to the entity resolver, which can then specify the actual source of the entity. If this parameter is not set, the resolution of entities in the document is implementation dependent. When the features "LS-Load" or "LS-Save" are supported, this parameter may also be supported by the `DOMConfiguration` object referenced from the `Document` node.
  `"certified"`
    `true`
      [ optional] Assume, when XML 1.1 is supported, that the input is certified (see section 2.13 in [XML 1.1]).
    `false`
      [required] ( default) Don't assume that the input is certified (see section 2.13 in [XML 1.1]).
  `"charset-overrides-xml-encoding"`
    `true`
      [ required] (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 [XML 1.0] 4.3.3 "Character Encoding in Entities"). Explicitly setting an encoding in the `DOMInputSource` overrides encodings from the protocol.
    `false`
      [required] Any character set encoding information from higher level protocols is ignored by the parser.
  `"supported-mediatypes-only"`
    `true`
      [optional] Check that the media type of the parsed resource is a supported media type and call the error handler if an unsupported media type is encountered. The media types defined in [IETF RFC 3023] must be accepted.
    `false`
      [required] (default) Don't check the media type, accept any type of data.
  `"unknown-characters"`
    `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.
    `false`
      [optional] Report an fatal error if a character is encountered for which the processor can not determine the normalization properties.
  Specified by:
    `getConfig` in interface `org.w3c.dom.ls.DOMBuilder`

### getFilter

    public org.w3c.dom.ls.DOMBuilderFilter 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.DOMBuilder`

### setFilter

    public void setFilter(org.w3c.dom.ls.DOMBuilderFilter 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.DOMBuilder`

### 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`. Should we allow implementations to raise exception if the type does not match? INVALID_ACCESS_ERR seems the closest exception code...
  Throws:
    `org.w3c.dom.DOMException` - NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but the requested value cannot be set.
    NOT_FOUND_ERR: Raised when the parameter name is not recognized.

### 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. "by a DOM application" prevents a DOM implementation to return its default behavior (such as the default "schema-type") if any.
  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.

### parseURI

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

  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.DOMBuilder`
  Following copied from interface: `org.w3c.dom.ls.DOMBuilder`
  Parameters:
    `uri` - The location of the XML document to be read.
  Returns:
    If the `DOMBuilder` is a synchronous `DOMBuilder` the newly created and populated `Document` is returned. If the `DOMBuilder` is asynchronous then `null` is returned since the document object is not yet parsed when this method returns.

### parse

    public org.w3c.dom.Document parse(org.w3c.dom.ls.DOMInputSource is)

  Parse an XML document from a resource identified by an `DOMInputSource`.
  Specified by:
    `parse` in interface `org.w3c.dom.ls.DOMBuilder`
  Following copied from interface: `org.w3c.dom.ls.DOMBuilder`
  Parameters:
    `is` - The `DOMInputSource` from which the source document is to be read.
  Returns:
    If the `DOMBuilder` is a synchronous `DOMBuilder` the newly created and populated `Document` is returned. If the `DOMBuilder` is asynchronous then `null` is returned since the document object is not yet parsed when this method returns.

### parseWithContext

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

  Parse an XML document or fragment from a resource identified by an `DOMInputSource` 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.DOMBuilder`
  Parameters:
    `is` - The `DOMInputSource` 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).

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

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