public interface DOMMetaFactory extends OMMetaFactory
OMMetaFactory
implementations that support
OMAbstractFactory.FEATURE_DOM
.
Axiom implementations supporting this feature MUST conform to the Axiom API as well as the DOM API, and nodes created by the implementation MUST implement both the Axiom interfaces and the DOM interfaces corresponding, as specified by the following table:
Axiom interface | DOM interface |
---|---|
OMDocument |
Document |
OMDocType |
DocumentType |
OMElement |
Element [1] |
OMAttribute |
Attr [2] |
OMText with type OMNode.TEXT_NODE or OMNode.SPACE_NODE |
Text |
OMText with type OMNode.CDATA_SECTION_NODE |
CDATASection |
OMComment |
Comment |
OMProcessingInstruction |
ProcessingInstruction |
OMEntityReference |
EntityReference |
Document.createElementNS(String, String)
.
Document.createAttributeNS(String, String)
and that don't represent namespace
declarations. Axiom doesn't use OMAttribute
to represent namespace declarations, and
OMNamespace
instances representing a namespace declarations are not expected to implement
Attr
.
The Axiom API is designed such that nodes are created using a factory (OMFactory
or
SOAPFactory
) that is expected to be a singleton and stateless. On the other hand, in the
DOM API, the Document
instance plays the role of node factory, and each node (explicitly
or implicitly) keeps a reference to the Document
instance from which it was created (the
owner document). To address this difference in a consistent way and to make it possible to
use both the Axiom API and the DOM API on the same object model instance, the implementation MUST
conform to the following rules:
OMFactory
that don't have an
OMContainer
parameter or that are invoked with a null
OMContainer
as well as to methods such as OMElement.cloneOMElement()
.
DOMException.WRONG_DOCUMENT_ERR
error.
OMNode.detach()
OMElement.removeAttribute(OMAttribute)
OMElement.setText(String)
and OMElement.setText(QName)
(in the case where the
side effect of the invocation is to detach preexisting nodes)
OMElement.addAttribute(OMAttribute)
and
OMElement.addAttribute(String, String, OMNamespace)
(in the case where the new attribute
replaces an existing one, which will be removed from its owner)
Document
instances created using the DocumentBuilderFactory
and
DOMImplementation
APIs as well as the Document
instances implicitly created (as
owner documents) by the Axiom API will have as their OMFactory
(as reported by
OMInformationItem.getOMFactory()
) the instance returned by
OMMetaFactory.getOMFactory()
. Any additional nodes created using the DOM API will inherit
the OMFactory
of the owner document.
The implementation SHOULD instantiate the implicitly created owner documents lazily (typically
when explicitly requested using DOM's Node.getOwnerDocument()
API) to avoid creating a
large number of temporary Document
instances when the Axiom API is used. Note however
that this no impact on the behavior visible to the application code.
Modifier and Type | Method and Description |
---|---|
DOMImplementation |
getDOMImplementation()
Get the
DOMImplementation instance. |
DocumentBuilderFactory |
newDocumentBuilderFactory()
Create a new
DocumentBuilderFactory . |
createOMBuilder, createOMBuilder, createOMBuilder, createOMBuilder, createOMBuilder, createSOAPModelBuilder, createSOAPModelBuilder, createStAXOMBuilder, createStAXSOAPModelBuilder, getOMFactory, getSOAP11Factory, getSOAP12Factory
DocumentBuilderFactory newDocumentBuilderFactory()
DocumentBuilderFactory
. Since Axiom doesn't support non namespace aware
processing, the returned factory is always configured with namespaceAware
set to
true
(in contrast to the default settings used by
DocumentBuilderFactory.newInstance()
).DOMImplementation getDOMImplementation()
DOMImplementation
instance.DOMImplementation
instanceCopyright © 2004–2018 The Apache Software Foundation. All rights reserved.