Interface OMFactory
-
- All Known Subinterfaces:
SOAPFactory
public interface OMFactory
Class OMFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method 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.OMElement
createOMElement(String localName, String namespaceURI, String prefix)
Create an element with the given name.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(QName qname)
Create an element with the givenQName
.OMElement
createOMElement(QName qname, OMContainer parent)
Create an element with the givenQName
and parent.OMSourcedElement
createOMElement(OMDataSource source)
Create a sourced element.OMSourcedElement
createOMElement(OMDataSource source, String localName, OMNamespace ns)
Create a sourced element with a known local name and namespace URI.OMSourcedElement
createOMElement(OMDataSource source, QName qname)
Create a sourced element with a known local name, namespace URI and namespace prefix.OMEntityReference
createOMEntityReference(OMContainer parent, String name)
Create an entity reference.OMNamespace
createOMNamespace(String uri, String prefix)
Create anOMNamespace
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)
Deprecated.UsecreateOMText(DataHandler, boolean)
instead.OMText
createOMText(String s)
OMText
createOMText(String s, int type)
OMText
createOMText(String s, String mimeType, boolean optimize)
OMText
createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize)
Create a binaryOMText
node supporting deferred loading of the content.OMText
createOMText(DataHandler dataHandler, boolean optimize)
OMText
createOMText(OMContainer parent, char[] charArary, int type)
Deprecated.OMText
createOMText(OMContainer parent, String text)
Creates a newOMText
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(OMContainer parent, QName text)
Deprecated.This method is only meaningful if it is used to create a text node that is the single child of anOMElement
.OMText
createOMText(OMContainer parent, QName text, int type)
Deprecated.Creating a text node containing a QName and having a type other thanOMNode.TEXT_NODE
is not meaningful.OMText
createOMText(OMContainer parent, OMText source)
Create OMText node that is a copy of the source text nodeOMMetaFactory
getMetaFactory()
Get theOMMetaFactory
from which this factory was obtained.OMInformationItem
importInformationItem(OMInformationItem informationItem)
Create a copy of the given information item using this factory.
-
-
-
Method Detail
-
getMetaFactory
OMMetaFactory getMetaFactory()
Get theOMMetaFactory
from which this factory was obtained. More precisely, if theOMFactory
instance has been obtained from aOMMetaFactory
usingOMMetaFactory.getOMFactory()
,OMMetaFactory.getSOAP11Factory()
orOMMetaFactory.getSOAP12Factory()
, then the return value is the same as the originalOMMetaFactory
. SinceOMAbstractFactory
creates a singleOMMetaFactory
instance per Axiom implementation, this means that this method can be used to check if twoOMFactory
instances belong to the same Axiom implementation.- Returns:
- the meta factory
-
createOMDocument
OMDocument createOMDocument()
Creates a new OMDocument.
-
createOMElement
OMElement createOMElement(String localName, OMNamespace ns)
Create an element with the given name. If a namespace is given, a namespace declaration will be added automatically to the newly created element.- Parameters:
localName
- the local part of the name; must not benull
ns
- the namespace, ornull
if the element has no namespace- Returns:
- the newly created element
- Throws:
IllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace name
-
createOMElement
OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMException
Create an element with the given name and parent. If the specifiedOMNamespace
has a namespace URI but anull
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 asOMNamespace
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.- Parameters:
localName
-ns
-parent
- the parent to which the newly created element will be added; this may benull
, in which case the behavior of the method is the same ascreateOMElement(String, OMNamespace)
- Returns:
- the newly created element
- Throws:
OMException
IllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace name
-
createOMElement
OMSourcedElement createOMElement(OMDataSource source)
Create a sourced element. If the data source implementsQNameAwareOMDataSource
then the returnedOMSourcedElement
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 implementQNameAwareOMDataSource
or because some of the methods defined by that interface returnnull
) 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.
- Parameters:
source
- the data source; must not benull
- Returns:
- the newly created element
- Throws:
IllegalArgumentException
- ifsource
isnull
-
createOMElement
OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns)
Create a sourced element with a known local name and namespace URI. If the namespace prefix is known in advance, then the caller should specify it in the providedOMNamespace
object. The caller may pass anOMNamespace
instance with anull
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 byQNameAwareOMDataSource.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.
- Parameters:
source
- the data source; must not benull
localName
- the local part of the name of the element produced by the data source; must not benull
ns
- the namespace of the element produced by the data source, ornull
if the element has no namespace- Returns:
- the newly created element
- Throws:
IllegalArgumentException
- ifsource
isnull
-
createOMElement
OMSourcedElement createOMElement(OMDataSource source, QName qname)
Create a sourced element with a known local name, namespace URI and namespace prefix.This is an optional operation which may not be supported by all factories.
- Parameters:
source
- the data source; must not benull
qname
- the name of the element produced by the data source; must not benull
- Returns:
- the newly created element
- Throws:
IllegalArgumentException
- ifsource
isnull
-
createOMElement
OMElement createOMElement(String localName, String namespaceURI, String prefix)
Create an element with the given name. If a namespace is given, a namespace declaration will be added automatically to the newly created element.- Parameters:
localName
- the local part of the name; must not benull
namespaceURI
- the namespace URI, or the empty string if the element has no namespace; must not benull
prefix
- the namespace prefix, ornull
if a prefix should be generated- Returns:
- the newly created OMElement.
- Throws:
IllegalArgumentException
- ifnamespaceURI
isnull
or if an attempt is made to create a prefixed element with an empty namespace name
-
createOMElement
OMElement createOMElement(QName qname, OMContainer parent)
Create an element with the givenQName
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.- Parameters:
qname
- theQName
defining the name of the element to be createdparent
- the parent to which the newly created element will be added; this may benull
, in which case the behavior of the method is the same ascreateOMElement(QName)
- Returns:
- the new element
- Throws:
IllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace name
-
createOMElement
OMElement createOMElement(QName qname)
Create an element with the givenQName
. 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 theQName
to the given namespace URI. If neither a namespace URI nor a prefix is given, no namespace declaration will be added.- Parameters:
qname
- theQName
defining the name of the element to be created- Returns:
- the new element
- Throws:
IllegalArgumentException
- if an attempt is made to create a prefixed element with an empty namespace name
-
createOMNamespace
OMNamespace createOMNamespace(String uri, String prefix)
Create anOMNamespace
instance or retrieve an existing one if the factory supports pooling.- Parameters:
uri
- the namespace URI; must not benull
prefix
- the prefix- Returns:
- the
OMNamespace
instance - Throws:
IllegalArgumentException
- ifuri
is null
-
createOMText
OMText createOMText(OMContainer parent, String text)
Creates a newOMText
node with the given value and appends it to the given parent element.- Parameters:
parent
- the parent to which the newly created text node will be added; this may benull
, in which case the behavior of the method is the same ascreateOMText(String)
text
-- Returns:
- Returns OMText.
-
createOMText
OMText createOMText(OMContainer parent, OMText source)
Create OMText node that is a copy of the source text node- Parameters:
parent
-source
-- Returns:
- TODO
-
createOMText
OMText createOMText(OMContainer parent, QName text)
Deprecated.This method is only meaningful if it is used to create a text node that is the single child of anOMElement
. However, for that purposeOMElement.setText(QName)
should be used.
-
createOMText
OMText createOMText(OMContainer parent, String text, int type)
- Parameters:
parent
-text
-type
- the node type:OMNode.TEXT_NODE
,OMNode.CDATA_SECTION_NODE
orOMNode.SPACE_NODE
- Returns:
- Returns OMText.
-
createOMText
OMText createOMText(OMContainer parent, char[] charArary, int type)
Deprecated.
-
createOMText
OMText createOMText(OMContainer parent, QName text, int type)
Deprecated.Creating a text node containing a QName and having a type other thanOMNode.TEXT_NODE
is not meaningful.
-
createOMText
OMText createOMText(String s, int type)
- Parameters:
s
-type
- the node type:OMNode.TEXT_NODE
,OMNode.CDATA_SECTION_NODE
orOMNode.SPACE_NODE
- Returns:
- Returns OMText.
-
createOMText
OMText createOMText(Object dataHandler, boolean optimize)
Deprecated.UsecreateOMText(DataHandler, boolean)
instead.
-
createOMText
OMText createOMText(DataHandler dataHandler, boolean optimize)
-
createOMText
OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize)
-
createOMText
OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider, boolean optimize)
Create a binaryOMText
node supporting deferred loading of the content.- Parameters:
contentID
- the content ID identifying the binary content; may benull
dataHandlerProvider
- used to load theDataHandler
when requested from the returnedOMText
nodeoptimize
- determines whether the binary content should be optimized- Returns:
- TODO
-
createOMAttribute
OMAttribute createOMAttribute(String localName, OMNamespace ns, String value)
Create an attribute with the given name and value. If the providedOMNamespace
object has anull
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 anull
OMNamespace
was given.- Parameters:
localName
-ns
-value
-- Returns:
- the newly created attribute
- Throws:
IllegalArgumentException
- if an attempt is made to create a prefixed attribute with an empty namespace name or an unprefixed attribute with a namespace
-
createOMDocType
OMDocType createOMDocType(OMContainer parent, String rootName, String publicId, String systemId, String internalSubset)
Creates DTD (DOCTYPE
declaration) node.- Parameters:
parent
- the parent to which the newly created text node will be added; this may benull
rootName
- the root name, i.e. the name immediately following theDOCTYPE
keywordpublicId
- the public ID of the external subset, ornull
if there is no external subset or no public ID has been specified for the external subsetsystemId
- the system ID of the external subset, ornull
if there is no external subsetinternalSubset
- the internal subset, ornull
if there is none- Returns:
- the newly created
OMDocType
node
-
createOMProcessingInstruction
OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData)
Creates a PI.- Parameters:
parent
-piTarget
-piData
-- Returns:
- Returns OMProcessingInstruction.
-
createOMComment
OMComment createOMComment(OMContainer parent, String content)
Creates a comment.- Parameters:
parent
-content
-- Returns:
- Returns OMComment.
-
createOMEntityReference
OMEntityReference createOMEntityReference(OMContainer parent, String name)
Create an entity reference.- Parameters:
parent
- the parent to which the newly created entity reference node will be added; this may benull
name
- the name of the entity- Returns:
- the newly created
OMEntityReference
node
-
importInformationItem
OMInformationItem importInformationItem(OMInformationItem informationItem)
Create a copy of the given information item using this factory. This method can be used to import information items created by other Axiom implementations. A copy will be created even if the original information item was created by this factory. BothOMSourcedElement
instances and model specific elements are always copied to plainOMElement
instances.- Parameters:
informationItem
- the information item to copy- Returns:
- the imported information item
-
-