The correct way to create a DOM Document
instance with Axiom is as follows. First, use OMAbstractFactory#getMetaFactory(String)
to get an OMMetaFactory
for the Axiom implementation that supports DOM. You do that by passing OMAbstractFactory.FEATURE_DOM
to that method. You then have two possibilities:
- Cast the
OMMetaFactory
toDOMMetaFactory
and use the JAXP/DOM compatible methods defined by that interface. - Use the Axiom API to create an
OMDocument
and cast it to aDocument
. In particular, if you want to parse an existing document, use one of the methods inOMXMLBuilderFactory
that takes anOMMetaFactory
orOMFactory
argument so that Axiom will use the DOM compatible implementation retrieved earlier.
Note that DOOMAbstractFactory
is deprecated and that StAXOMBuilder
is considered an internal implementation class (as the package name org.apache.axiom.om.impl.builder
implies) that should not be used directly.