public class ElementHelper extends Object
Constructor and Description |
---|
ElementHelper(OMElement element)
Constructs and binds to an element.
|
Modifier and Type | Method and Description |
---|---|
static OMElement |
getChildWithName(OMElement parent,
String childName)
Deprecated.
please use OMElement.getFirstChildWithName(qname) instead!
|
static String |
getContentID(javax.xml.stream.XMLStreamReader parser) |
static String |
getContentID(javax.xml.stream.XMLStreamReader parser,
String charsetEncoding)
Deprecated.
use
getContentID(XMLStreamReader) instead (see WSCOMMONS-429) |
static String |
getContentIDFromHref(String href)
Extract the content ID from a href attribute value, i.e. from a URI following the
cid: scheme defined by RFC2392.
|
static Reader |
getTextAsStream(OMElement element,
boolean cache)
Returns a stream representing the concatenation of the text nodes that are children of a
given element.
|
static OMElement |
importOMElement(OMElement omElement,
OMFactory omFactory)
Some times two OMElements needs to be added to the same object tree.
|
QName |
resolveQName(String qname)
Deprecated.
The algorithm used by this method is incorrect. See AXIOM-356 for more
details.
|
QName |
resolveQName(String qname,
boolean defaultToParentNameSpace)
Deprecated.
The algorithm used by this method is incorrect. See AXIOM-356 for more
details.
|
static void |
setNewElement(OMElement parent,
OMElement myElement,
OMElement newElement) |
static SOAPHeaderBlock |
toSOAPHeaderBlock(OMElement omElement,
SOAPFactory factory)
This is a method to convert regular OMElements to SOAPHeaderBlocks.
|
static void |
writeTextTo(OMElement element,
Writer out,
boolean cache)
Write the content of the text nodes that are children of a given element to a
Writer . |
public ElementHelper(OMElement element)
element
- element to work withpublic QName resolveQName(String qname, boolean defaultToParentNameSpace)
public QName resolveQName(String qname)
public static void setNewElement(OMElement parent, OMElement myElement, OMElement newElement)
public static OMElement getChildWithName(OMElement parent, String childName)
public static String getContentID(javax.xml.stream.XMLStreamReader parser, String charsetEncoding)
getContentID(XMLStreamReader)
instead (see WSCOMMONS-429)public static String getContentID(javax.xml.stream.XMLStreamReader parser)
public static String getContentIDFromHref(String href)
href
- the value of the href attributepublic static OMElement importOMElement(OMElement omElement, OMFactory omFactory)
to convert instances of
OMAttribute
public static SOAPHeaderBlock toSOAPHeaderBlock(OMElement omElement, SOAPFactory factory) throws Exception
omElement
- factory
- Exception
public static Reader getTextAsStream(OMElement element, boolean cache)
new StringReader(element.getText())The difference is that the stream implementation returned by this method is guaranteed to have constant memory usage and is optimized for performance.
element
- the element to read the text nodes fromcache
- whether to enable caching when accessing the elementOMElement.getText()
public static void writeTextTo(OMElement element, Writer out, boolean cache) throws javax.xml.stream.XMLStreamException, IOException
Writer
.
If cache
is true, this method has the same effect as the following instruction:
out.write(element.getText())The difference is that this method is guaranteed to have constant memory usage and is optimized for performance.
element
- the element to read the text nodes fromout
- the stream to write the content tocache
- whether to enable caching when accessing the elementjavax.xml.stream.XMLStreamException
- if an error occurs when reading from the elementIOException
- if an error occurs when writing to the streamOMElement.getText()
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.