org.apache.axiom.om.util

## Class ElementHelper

- java.lang.Object
- - org.apache.axiom.om.util.ElementHelper

-     public class ElementHelper
      extends Object

  Helper class to provide extra utility stuff against elements. The code is designed to work with any element implementation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ElementHelper(OMElement element)` Constructs and binds to an element.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    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 AXIOM-129)
    `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)` Deprecated. Use `OMElement.getTextAsStream(boolean)` instead.
    `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)` Deprecated.
    `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)` Deprecated. Use `OMElement.writeTextTo(Writer, boolean)` instead.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ElementHelper

          public ElementHelper(OMElement element)

      Constructs and binds to an element.
      Parameters:
        `element` - element to work with

  - ### Method Detail

    - #### resolveQName

          public QName resolveQName(String qname,
                                    boolean defaultToParentNameSpace)

      Deprecated. The algorithm used by this method is incorrect. See AXIOM-356 for more details.

    - #### resolveQName

          public QName resolveQName(String qname)

      Deprecated. The algorithm used by this method is incorrect. See AXIOM-356 for more details.

    - #### setNewElement

          public static void setNewElement(OMElement parent,
                                           OMElement myElement,
                                           OMElement newElement)

      Deprecated.

    - #### getChildWithName

          public static OMElement getChildWithName(OMElement parent,
                                                   String childName)

      Deprecated. please use OMElement.getFirstChildWithName(qname) instead!

    - #### getContentID

          public static String getContentID(javax.xml.stream.XMLStreamReader parser,
                                            String charsetEncoding)

      Deprecated. use `getContentID(XMLStreamReader)` instead (see AXIOM-129)

    - #### getContentID

          public static String getContentID(javax.xml.stream.XMLStreamReader parser)

    - #### getContentIDFromHref

          public 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.
      Parameters:
        `href` - the value of the href attribute
      Returns:
        the corresponding content ID

    - #### importOMElement

          public static OMElement importOMElement(OMElement omElement,
                                                  OMFactory omFactory)

      Some times two OMElements needs to be added to the same object tree. But in Axiom, a single tree should always contain object created from the same type of factory (eg: LinkedListImplFactory, DOMFactory, etc.,). If one OMElement is created from a different factory than that of the factory which was used to create the object in the existing tree, we need to convert the new OMElement to match to the factory of existing object tree. This method will convert omElement to the given omFactory.
      See Also:
        `to convert instances of OMAttribute`

    - #### toSOAPHeaderBlock

          public static SOAPHeaderBlock toSOAPHeaderBlock(OMElement omElement,
                                                          SOAPFactory factory)
                                                   throws Exception

      This is a method to convert regular OMElements to SOAPHeaderBlocks.
      Parameters:
        `omElement` -
        `factory` -
      Returns:
        TODO
      Throws:
        `Exception`

    - #### getTextAsStream

          public static Reader getTextAsStream(OMElement element,
                                               boolean cache)

      Deprecated. Use `OMElement.getTextAsStream(boolean)` instead.

    - #### writeTextTo

          public static void writeTextTo(OMElement element,
                                         Writer out,
                                         boolean cache)
                                  throws javax.xml.stream.XMLStreamException,
                                         IOException

      Deprecated. Use `OMElement.writeTextTo(Writer, boolean)` instead.
      Throws:
        `javax.xml.stream.XMLStreamException`
        `IOException`

Copyright © The Apache Software Foundation. All Rights Reserved.