public class OMDOMFactory extends Object implements OMFactory
org.w3c.dom
.
Since DOM requires every node to have an owner document even if it has not yet
been added to a tree, this factory internally maintains a reference to a
DocumentImpl
instance. The document can be set explicitly using the
OMDOMFactory(DocumentImpl)
constructor or the setDocument(DocumentImpl)
method. If none is set, it will be implicitly created when the first node is created.
All nodes created by this factory will have this DocumentImpl
instance as owner
document.
This has several important consequences:
setDocument(DocumentImpl)
is used
to reset the DocumentImpl
instance before processing the next document.Modifier and Type | Field and Description |
---|---|
protected DocumentImpl |
document |
Constructor and Description |
---|
OMDOMFactory() |
OMDOMFactory(DocumentImpl doc) |
OMDOMFactory(OMDOMMetaFactory metaFactory) |
Modifier and Type | Method and Description |
---|---|
OMAttribute |
createOMAttribute(String localName,
OMNamespace ns,
String value) |
OMComment |
createOMComment(OMContainer parent,
String content)
Creates a comment.
|
OMDocType |
createOMDocType(OMContainer parent,
String content)
Creates DocType/DTD.
|
OMDocument |
createOMDocument()
Creates a new OMDocument.
|
OMDocument |
createOMDocument(OMXMLParserWrapper builder) |
OMSourcedElement |
createOMElement(OMDataSource source,
QName qname)
Unsupported.
|
OMSourcedElement |
createOMElement(OMDataSource source,
String localName,
OMNamespace ns)
Construct element with arbitrary data source.
|
OMElement |
createOMElement(OMDataSource source,
String localName,
OMNamespace ns,
OMContainer parent) |
OMElement |
createOMElement(QName qname)
Create an OMElement with the given QName
If the QName contains a prefix, we will ensure that an OMNamespace is created mapping the
given namespace to the given prefix.
|
OMElement |
createOMElement(QName qname,
OMContainer parent)
Creates a new OMDOM Element node and adds it to the given parent.
|
OMElement |
createOMElement(String localName,
OMNamespace ns)
Create an element with the given name.
|
OMElement |
createOMElement(String localName,
OMNamespace ns,
OMContainer parent) |
OMElement |
createOMElement(String localName,
OMNamespace ns,
OMContainer parent,
OMXMLParserWrapper builder)
Creates an OMElement with the builder.
|
OMElement |
createOMElement(String localName,
String namespaceURI,
String prefix)
Create an element with the given name.
|
OMNamespace |
createOMNamespace(String uri,
String prefix)
Creates a new OMNamespace.
|
OMProcessingInstruction |
createOMProcessingInstruction(OMContainer parent,
String piTarget,
String piData)
Creates a PI.
|
OMText |
createOMText(Object dataHandler,
boolean optimize)
Creates a new OMDOM Text node with the given datahandler and the given MTOM optimization
configuration and returns it.
|
OMText |
createOMText(OMContainer parent,
char[] charArary,
int type) |
OMText |
createOMText(OMContainer parent,
OMText source)
Create OMText node that is a copy of the source text node
|
OMText |
createOMText(OMContainer parent,
QName text) |
OMText |
createOMText(OMContainer parent,
QName text,
int type) |
OMText |
createOMText(OMContainer parent,
String text)
Creates a new
OMText node with the given value and appends it to the given parent
element. |
OMText |
createOMText(OMContainer parent,
String text,
int type) |
OMText |
createOMText(OMContainer parent,
String s,
String mimeType,
boolean optimize)
Creates an OMDOM Text node, adds it to the give parent element and returns it.
|
OMText |
createOMText(String s)
Creates a OMDOM Text node carrying the given value.
|
OMText |
createOMText(String contentID,
DataHandlerProvider dataHandlerProvider,
boolean optimize)
Create a binary
OMText node supporting deferred loading of the content. |
OMText |
createOMText(String text,
int type)
Creates a Character node of the given type.
|
OMText |
createOMText(String contentID,
OMContainer parent,
OMXMLParserWrapper builder) |
OMText |
createOMText(String text,
String mimeType,
boolean optimize)
Creates a new OMDOM Text node with the value of the given text value along with the MTOM
optimization parameters and returns it.
|
DocumentImpl |
getDocument() |
OMMetaFactory |
getMetaFactory()
Get the
OMMetaFactory from which this factory was obtained. |
void |
setDocument(DocumentImpl document)
Configure this factory to use the given document.
|
protected DocumentImpl document
public OMDOMFactory(OMDOMMetaFactory metaFactory)
public OMDOMFactory()
public OMDOMFactory(DocumentImpl doc)
public OMMetaFactory getMetaFactory()
OMFactory
OMMetaFactory
from which this factory was obtained.getMetaFactory
in interface OMFactory
public OMDocument createOMDocument()
OMFactory
createOMDocument
in interface OMFactory
public void setDocument(DocumentImpl document)
document
- public OMElement createOMElement(String localName, OMNamespace ns)
OMFactory
createOMElement
in interface OMFactory
localName
- the local part of the name; must not be null
ns
- the namespace, or null
if the element has no namespacepublic OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMDOMException
createOMElement
in interface OMFactory
parent
- the parent to which the newly created element will be added; this may be
null
, in which case the behavior of the method is the same as
OMFactory.createOMElement(String, OMNamespace)
OMDOMException
public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder)
createOMElement
in interface OMFactory
ns
- - this can be nullpublic OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns, OMContainer parent)
public OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns)
OMFactory
createOMElement
in interface OMFactory
public OMSourcedElement createOMElement(OMDataSource source, QName qname)
createOMElement
in interface OMFactory
source
- the data sourceqname
- the name of the element produced by the data sourcepublic OMElement createOMElement(String localName, String namespaceURI, String prefix)
OMFactory
createOMElement
in interface OMFactory
localName
- the local part of the name; must not be null
namespaceURI
- the namespace URI, or the empty string if the element has no namespace; must not
be null
prefix
- the namespace prefix, or null
if a prefix should be generatedpublic OMElement createOMElement(QName qname, OMContainer parent) throws OMException
createOMElement
in interface OMFactory
qname
- the QName of the element to createparent
- the parent to which the newly created element will be added; this may be
null
, in which case the behavior of the method is the same as
OMFactory.createOMElement(QName)
OMException
- if there's a namespace mapping problemcreateOMElement(String, OMNamespace, OMContainer)
,
OMFactory.createOMElement( javax.xml.namespace.QName,
org.apache.axiom.om.OMContainer)
public OMElement createOMElement(QName qname) throws OMException
createOMElement
in interface OMFactory
qname
- OMException
- TODO: when???public OMNamespace createOMNamespace(String uri, String prefix)
createOMNamespace
in interface OMFactory
uri
- the namespace URI; must not be null
prefix
- the prefixOMNamespace
instanceOMFactory.createOMNamespace(String, String)
public OMText createOMText(OMContainer parent, String text)
OMFactory
OMText
node with the given value and appends it to the given parent
element.createOMText
in interface OMFactory
public OMText createOMText(OMContainer parent, QName text)
createOMText
in interface OMFactory
text
- - This text itself can contain a namespace inside it.public OMText createOMText(OMContainer parent, QName text, int type)
createOMText
in interface OMFactory
text
- - This text itself can contain a namespace inside it.public OMText createOMText(OMContainer parent, String text, int type)
createOMText
in interface OMFactory
type
- - this should be either of XMLStreamConstants.CHARACTERS,
XMLStreamConstants.CDATA, XMLStreamConstants.SPACE, XMLStreamConstants.ENTITY_REFERENCEpublic OMText createOMText(OMContainer parent, OMText source)
OMFactory
createOMText
in interface OMFactory
public OMText createOMText(OMContainer parent, char[] charArary, int type)
createOMText
in interface OMFactory
public OMText createOMText(String s)
createOMText
in interface OMFactory
OMFactory.createOMText(String)
public OMText createOMText(String text, int type)
createOMText
in interface OMFactory
type
- - OMText node can handle SPACE, CHARACTERS, CDATA and ENTITY REFERENCES. For
Constants, use either XMLStreamConstants or constants found in OMNode.OMFactory.createOMText(String, int)
public OMText createOMText(String text, String mimeType, boolean optimize)
createOMText
in interface OMFactory
OMFactory.createOMText(String, String, boolean)
public OMText createOMText(Object dataHandler, boolean optimize)
createOMText
in interface OMFactory
OMFactory.createOMText(Object, boolean)
public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize)
OMFactory
OMText
node supporting deferred loading of the content.createOMText
in interface OMFactory
contentID
- the content ID identifying the binary content; may be null
dataHandlerProvider
- used to load the DataHandler
when requested from the returned
OMText
nodeoptimize
- determines whether the binary content should be optimizedpublic OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize)
createOMText
in interface OMFactory
OMFactory.createOMText(OMContainer, String,
String, boolean)
public OMText createOMText(String contentID, OMContainer parent, OMXMLParserWrapper builder)
createOMText
in interface OMFactory
public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value)
createOMAttribute
in interface OMFactory
public OMDocType createOMDocType(OMContainer parent, String content)
OMFactory
createOMDocType
in interface OMFactory
public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData)
OMFactory
createOMProcessingInstruction
in interface OMFactory
public OMComment createOMComment(OMContainer parent, String content)
OMFactory
createOMComment
in interface OMFactory
public DocumentImpl getDocument()
public OMDocument createOMDocument(OMXMLParserWrapper builder)
createOMDocument
in interface OMFactory
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.