Class DOMParserImpl

All Implemented Interfaces:
org.apache.xerces.xni.XMLDocumentHandler, org.apache.xerces.xni.XMLDTDContentModelHandler, org.apache.xerces.xni.XMLDTDHandler, DOMConfiguration, LSParser
Direct Known Subclasses:
DOMASBuilderImpl

public class DOMParserImpl extends AbstractDOMParser implements LSParser, 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 784915 2009-06-15 18:54:11Z knoaman $
Author:
Pavani Mukthipudi, Sun Microsystems Inc., Elena Litani, IBM, Rahul Srivastava, Sun Microsystems Inc.
  • Field Details

    • NAMESPACES

      protected static final String NAMESPACES
      Feature identifier: namespaces.
      See Also:
    • VALIDATION_FEATURE

      protected static final String VALIDATION_FEATURE
      Feature id: validation.
      See Also:
    • XMLSCHEMA

      protected static final String XMLSCHEMA
      XML Schema validation
      See Also:
    • XMLSCHEMA_FULL_CHECKING

      protected static final String XMLSCHEMA_FULL_CHECKING
      XML Schema full checking
      See Also:
    • DYNAMIC_VALIDATION

      protected static final String DYNAMIC_VALIDATION
      Dynamic validation
      See Also:
    • NORMALIZE_DATA

      protected static final String NORMALIZE_DATA
      Feature identifier: expose schema normalized value
      See Also:
    • DISALLOW_DOCTYPE_DECL_FEATURE

      protected static final String DISALLOW_DOCTYPE_DECL_FEATURE
      Feature identifier: disallow docType Decls.
      See Also:
    • HONOUR_ALL_SCHEMALOCATIONS

      protected static final String HONOUR_ALL_SCHEMALOCATIONS
      Feature identifier: honour all schemaLocations
      See Also:
    • NAMESPACE_GROWTH

      protected static final String NAMESPACE_GROWTH
      Feature identifier: namespace growth
      See Also:
    • TOLERATE_DUPLICATES

      protected static final String TOLERATE_DUPLICATES
      Feature identifier: tolerate duplicates
      See Also:
    • SYMBOL_TABLE

      protected static final String SYMBOL_TABLE
      See Also:
    • PSVI_AUGMENT

      protected static final String PSVI_AUGMENT
      See Also:
    • fNamespaceDeclarations

      protected boolean fNamespaceDeclarations
      Include namespace declaration attributes in the document.
    • fSchemaType

      protected String fSchemaType
    • fBusy

      protected boolean fBusy
    • DEBUG

      protected static final boolean DEBUG
      See Also:
  • Constructor Details

    • DOMParserImpl

      public DOMParserImpl(String configuration, 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 Details

    • reset

      public void reset()
      Resets the parser state.
      Overrides:
      reset in class AbstractDOMParser
    • getDomConfig

      public DOMConfiguration getDomConfig()
      Specified by:
      getDomConfig in interface LSParser
    • getFilter

      public LSParserFilter getFilter()
      When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure. The filter can choose to remove elements from the document being constructed, or to terminate the parsing early.
      The filter is invoked after the operations requested by the DOMConfiguration parameters have been applied. For example, if " validate" is set to true, the validation is done before invoking the filter.
      Specified by:
      getFilter in interface LSParser
    • setFilter

      public void setFilter(LSParserFilter filter)
      When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure. The filter can choose to remove elements from the document being constructed, or to terminate the parsing early.
      The filter is invoked after the operations requested by the DOMConfiguration parameters have been applied. For example, if " validate" is set to true, the validation is done before invoking the filter.
      Specified by:
      setFilter in interface LSParser
    • setParameter

      public void setParameter(String name, Object value) throws DOMException
      Set parameters and properties
      Specified by:
      setParameter in interface DOMConfiguration
      Throws:
      DOMException
    • getParameter

      public Object getParameter(String name) throws DOMException
      Look up the value of a feature or a property.
      Specified by:
      getParameter in interface DOMConfiguration
      Throws:
      DOMException
    • canSetParameter

      public boolean canSetParameter(String name, Object value)
      Specified by:
      canSetParameter in interface DOMConfiguration
    • getParameterNames

      public 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 DOMConfiguration
    • parseURI

      public Document parseURI(String uri) throws 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 LSParser
      Throws:
      LSException
    • parse

      public Document parse(LSInput is) throws LSException
      Parse an XML document from a resource identified by an LSInput.
      Specified by:
      parse in interface LSParser
      Throws:
      LSException
    • parseWithContext

      public Node parseWithContext(LSInput is, Node cnode, short action) throws DOMException, 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 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:
      DOMException - HIERARCHY_REQUEST_ERR: Thrown if this action results in an invalid hierarchy (i.e. a Document with more than one document element).
      LSException
    • getAsync

      public boolean getAsync()
      Specified by:
      getAsync in interface LSParser
      See Also:
    • getBusy

      public boolean getBusy()
      Specified by:
      getBusy in interface LSParser
      See Also:
    • abort

      public void abort()
      Specified by:
      abort in interface LSParser
      Overrides:
      abort in class AbstractDOMParser
      See Also:
    • startElement

      public void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)
      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. Overriding the parent to handle DOM_NAMESPACE_DECLARATIONS=false.
      Specified by:
      startElement in interface org.apache.xerces.xni.XMLDocumentHandler
      Overrides:
      startElement in class AbstractDOMParser
      Parameters:
      element - The name of the element.
      attributes - The element attributes.
      augs - Additional information that may include infoset augmentations
      Throws:
      org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.