public interface OMFactory
Modifier and Type | Method and Description |
---|---|
OMAttribute |
createOMAttribute(String localName,
OMNamespace ns,
String value)
Create an attribute with the given name and value.
|
OMComment |
createOMComment(OMContainer parent,
String content)
Creates a comment.
|
OMDocType |
createOMDocType(OMContainer parent,
String rootName,
String publicId,
String systemId,
String internalSubset)
Creates DTD (DOCTYPE declaration) node.
|
OMDocument |
createOMDocument()
Creates a new OMDocument.
|
OMSourcedElement |
createOMElement(OMDataSource source)
Create a sourced element.
|
OMSourcedElement |
createOMElement(OMDataSource source,
QName qname)
Create a sourced element with a known local name, namespace URI and namespace prefix.
|
OMSourcedElement |
createOMElement(OMDataSource source,
String localName,
OMNamespace ns)
Create a sourced element with a known local name and namespace URI.
|
OMElement |
createOMElement(QName qname)
Create an element with the given
QName . |
OMElement |
createOMElement(QName qname,
OMContainer parent)
Create an element with the given
QName and parent. |
OMElement |
createOMElement(String localName,
OMNamespace ns)
Create an element with the given name.
|
OMElement |
createOMElement(String localName,
OMNamespace ns,
OMContainer parent)
Create an element with the given name and parent.
|
OMElement |
createOMElement(String localName,
String namespaceURI,
String prefix)
Create an element with the given name.
|
OMEntityReference |
createOMEntityReference(OMContainer parent,
String name)
Create an entity reference.
|
OMNamespace |
createOMNamespace(String uri,
String prefix)
Create an
OMNamespace instance or retrieve an existing one if the factory supports
pooling. |
OMProcessingInstruction |
createOMProcessingInstruction(OMContainer parent,
String piTarget,
String piData)
Creates a PI.
|
OMText |
createOMText(Object dataHandler,
boolean optimize) |
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) |
OMText |
createOMText(String s) |
OMText |
createOMText(String contentID,
DataHandlerProvider dataHandlerProvider,
boolean optimize)
Create a binary
OMText node supporting deferred loading of the content. |
OMText |
createOMText(String s,
int type) |
OMText |
createOMText(String s,
String mimeType,
boolean optimize) |
OMMetaFactory |
getMetaFactory()
Get the
OMMetaFactory from which this factory was obtained. |
OMMetaFactory getMetaFactory()
OMMetaFactory
from which this factory was obtained. More precisely, if the
OMFactory
instance has been obtained from a OMMetaFactory
using
OMMetaFactory.getOMFactory()
, OMMetaFactory.getSOAP11Factory()
or
OMMetaFactory.getSOAP12Factory()
, then the return value is the same as the original
OMMetaFactory
. Since OMAbstractFactory
creates a single OMMetaFactory
instance per Axiom implementation, this means that this method can be used to check if two
OMFactory
instances belong to the same Axiom implementation.OMDocument createOMDocument()
OMElement createOMElement(String localName, OMNamespace ns)
localName
- the local part of the name; must not be null
ns
- the namespace, or null
if the element has no namespaceIllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace nameOMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMException
OMNamespace
has a
namespace URI but a null
prefix, the method will reuse an existing prefix if a
namespace declaration with a matching namespace URI is in scope on the parent or generate a
new prefix if no such namespace declaration exists.
If a new prefix is generated or if the specified prefix and namespace URI are not bound in
the scope of the parent element, the method will add an appropriate namespace declaration to
the new element. Note that this may also occur if null
is passed as
OMNamespace
parameter. In that case, if there is a default namespace declaration with
a non empty namespace URI in the scope of the parent element, a namespace declaration needs
to be added to the newly created element to override the default namespace.
localName
- ns
- 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
createOMElement(String, OMNamespace)
OMException
IllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace nameOMSourcedElement createOMElement(OMDataSource source)
QNameAwareOMDataSource
then
the returned OMSourcedElement
will use the information provided through this
interface to determine the local name, namespace URI and namespace prefix. For information
that is not available (either because the data source doesn't implement
QNameAwareOMDataSource
or because some of the methods defined by that interface
return null
) the element will be expanded to determine the missing information.
This is done lazily, i.e. only when the information is really required. E.g. this will not
occur during serialization of the element.
This is an optional operation which may not be supported by all factories.
source
- the data source; must not be null
IllegalArgumentException
- if source
is null
OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns)
OMNamespace
object. The caller may pass an OMNamespace
instance with a null
prefix.
This indicates that the prefix is unknown and will be determined lazily by expanding the
element.
Note that if the provided data source implements QNameAwareOMDataSource
, then the
information returned by QNameAwareOMDataSource.getPrefix()
may be used to determine
the prefix. However, this is an unusual use case.
Also note that if the specified namespace URI is empty, then the element can't have a prefix and it is not necessary to expand the element to determine its prefix.
This is an optional operation which may not be supported by all factories.
source
- the data source; must not be null
localName
- the local part of the name of the element produced by the data source; must not be
null
ns
- the namespace of the element produced by the data source, or null
if
the element has no namespaceIllegalArgumentException
- if source
is null
OMSourcedElement createOMElement(OMDataSource source, QName qname)
This is an optional operation which may not be supported by all factories.
source
- the data source; must not be null
qname
- the name of the element produced by the data source; must not be null
IllegalArgumentException
- if source
is null
OMElement createOMElement(String localName, String namespaceURI, String prefix)
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 generatedIllegalArgumentException
- if namespaceURI
is null
or if an attempt is made to
create a prefixed element with an empty namespace nameOMElement createOMElement(QName qname, OMContainer parent)
QName
and parent. If a namespace URI is given but no
prefix, the method will use an appropriate prefix if a corresponding namespace declaration is
in scope on the parent or generate a new prefix if no corresponding namespace declaration is
in scope. If a new prefix is generated or if the specified prefix and namespace URI are not
bound in the scope of the parent element, the method will add an appropriate namespace
declaration to the new element.qname
- the QName
defining the name of the element to be createdparent
- 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
createOMElement(QName)
IllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace nameOMElement createOMElement(QName qname)
QName
. If a namespace URI is given but no prefix,
the method will automatically generate a prefix for the element. If a namespace URI is given,
the method will also add a namespace declaration to the element, binding the auto-generated
prefix or the prefix given in the QName
to the given namespace URI. If neither a
namespace URI nor a prefix is given, no namespace declaration will be added.qname
- the QName
defining the name of the element to be createdIllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace nameOMNamespace createOMNamespace(String uri, String prefix)
OMNamespace
instance or retrieve an existing one if the factory supports
pooling.uri
- the namespace URI; must not be null
prefix
- the prefixOMNamespace
instanceIllegalArgumentException
- if uri
is nullOMText createOMText(OMContainer parent, String text)
OMText
node with the given value and appends it to the given parent
element.parent
- the parent to which the newly created text node will be added; this may be
null
, in which case the behavior of the method is the same as
createOMText(String)
text
- OMText createOMText(OMContainer parent, OMText source)
parent
- source
- OMText createOMText(OMContainer parent, QName text)
parent
- text
- - This text itself can contain a namespace inside it.OMText createOMText(OMContainer parent, String text, int type)
parent
- text
- type
- the node type: OMNode.TEXT_NODE
, OMNode.CDATA_SECTION_NODE
or
OMNode.SPACE_NODE
OMText createOMText(OMContainer parent, char[] charArary, int type)
OMText createOMText(OMContainer parent, QName text, int type)
parent
- text
- - This text itself can contain a namespace inside it.type
- OMText createOMText(String s, int type)
s
- type
- the node type: OMNode.TEXT_NODE
, OMNode.CDATA_SECTION_NODE
or
OMNode.SPACE_NODE
OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize)
OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize)
OMText
node supporting deferred loading of the content.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 optimizedOMAttribute createOMAttribute(String localName, OMNamespace ns, String value)
OMNamespace
object
has a null
prefix, then a prefix will be generated, except if the namespace URI
is the empty string, in which case the result is the same as if a null
OMNamespace
was given.localName
- ns
- value
- IllegalArgumentException
- if an attempt is made to create a prefixed attribute with an empty namespace nameOMDocType createOMDocType(OMContainer parent, String rootName, String publicId, String systemId, String internalSubset)
parent
- the parent to which the newly created text node will be added; this may be
null
rootName
- the root name, i.e. the name immediately following the DOCTYPE keywordpublicId
- the public ID of the external subset, or null
if there is no external
subset or no public ID has been specified for the external subsetsystemId
- the system ID of the external subset, or null
if there is no external
subsetinternalSubset
- the internal subset, or null
if there is noneOMDocType
nodeOMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData)
parent
- piTarget
- piData
- OMComment createOMComment(OMContainer parent, String content)
parent
- content
- OMEntityReference createOMEntityReference(OMContainer parent, String name)
parent
- the parent to which the newly created entity reference node will be added; this
may be null
name
- the name of the entityOMEntityReference
nodeCopyright © 2004–2018 The Apache Software Foundation. All rights reserved.