org.apache.ws.util
Class XmlBeanUtils

java.lang.Object
  extended byorg.apache.ws.util.XmlBeanUtils

public abstract class XmlBeanUtils
extends java.lang.Object

LOG-DONE Generic utility methods for working with Apache XMLBeans.

Author:
Ian P. Springer, Sal Campana

Constructor Summary
XmlBeanUtils()
           
 
Method Summary
static org.apache.xmlbeans.XmlObject addChildElement(org.apache.xmlbeans.XmlObject parentXBean, javax.xml.namespace.QName name)
          Adds an XmlBean with the specified name as the last of the specified parent XmlBean.
static org.apache.xmlbeans.XmlObject addChildElement(org.apache.xmlbeans.XmlObject parentXBean, org.apache.xmlbeans.XmlObject xBean)
          Adds a copy of the specified XmlBean as the last child element of the specified parent XmlBean.
static org.apache.xmlbeans.XmlObject copyXmlBean(org.apache.xmlbeans.XmlObject srcXBean)
          Makes and returns a copy of the specified XMLBean.
static org.apache.xmlbeans.XmlObject[] copyXmlBeans(org.apache.xmlbeans.XmlObject[] srcXBeans)
          Makes and returns a copy of the specified XMLBean array.
static java.lang.String getAttributeValue(org.apache.xmlbeans.XmlObject xBean, javax.xml.namespace.QName attribName)
           
static javax.xml.namespace.QName getAttributeValueAsQName(org.apache.xmlbeans.XmlObject xBean, javax.xml.namespace.QName attribName)
           
static org.apache.xmlbeans.XmlObject[] getChildElements(org.apache.xmlbeans.XmlObject xBean)
          TODO
static org.apache.xmlbeans.XmlObject[] getChildElements(org.apache.xmlbeans.XmlObject xBean, javax.xml.namespace.QName name)
          TODO
static org.apache.xmlbeans.XmlObject getDocument(org.apache.xmlbeans.XmlObject xBean)
          Returns the document XmlBean that is associated with the specified XmlBean.
static javax.xml.namespace.QName getName(org.apache.xmlbeans.XmlCursor xCursor)
          Note.
static javax.xml.namespace.QName getName(org.apache.xmlbeans.XmlObject xBean)
           
static org.apache.xmlbeans.XmlObject getRootElement(org.apache.xmlbeans.XmlObject docXBean)
          Returns the root element of the specified document XMLBean.
static java.lang.String getValue(org.apache.xmlbeans.XmlObject xBean)
           
static javax.xml.namespace.QName getValueAsQName(org.apache.xmlbeans.XmlObject xBean)
           
static java.util.Map getXmlBeanAnyMap(org.apache.xmlbeans.XmlObject xmlObjectToSearch)
          Returns a Map keyed on Element QName to a List containing the "Any" XmlObjects types.
static boolean isDocument(org.apache.xmlbeans.XmlObject xBean)
          DOCUMENT_ME
 org.apache.xmlbeans.XmlObject newInstance(javax.xml.namespace.QName elemName)
           
static void remove(org.apache.xmlbeans.XmlObject xBean)
          Removes the specifed XMLBean from its parent element.
static boolean removeChildElements(org.apache.xmlbeans.XmlObject xBean)
          Removes all child elements of the specified XMLBean.
static boolean removeChildElements(org.apache.xmlbeans.XmlObject xBean, javax.xml.namespace.QName name)
          Removes all child elements, with the specified name, from the specified XMLBean.
static void setValue(org.apache.xmlbeans.XmlObject xBean, java.lang.String value)
           
static void setValueAsQName(org.apache.xmlbeans.XmlObject xBean, javax.xml.namespace.QName qName)
           
static javax.xml.soap.SOAPElement toSOAPElement(org.apache.xmlbeans.XmlObject xBean)
           
static javax.xml.soap.SOAPElement[] toSOAPElementArray(org.apache.xmlbeans.XmlObject[] elems)
          DOCUMENT_ME
static org.apache.xmlbeans.XmlObject toXmlObject(java.lang.Object obj)
          If possible, converts the specified object to an XMLBean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlBeanUtils

public XmlBeanUtils()
Method Detail

getChildElements

public static org.apache.xmlbeans.XmlObject[] getChildElements(org.apache.xmlbeans.XmlObject xBean,
                                                               javax.xml.namespace.QName name)
TODO

Parameters:
xBean -
name - name to look for, or null to return all child elements
Returns:

getChildElements

public static org.apache.xmlbeans.XmlObject[] getChildElements(org.apache.xmlbeans.XmlObject xBean)
TODO

Parameters:
xBean -
Returns:

isDocument

public static boolean isDocument(org.apache.xmlbeans.XmlObject xBean)
DOCUMENT_ME

Parameters:
xBean - DOCUMENT_ME
Returns:
DOCUMENT_ME

getDocument

public static org.apache.xmlbeans.XmlObject getDocument(org.apache.xmlbeans.XmlObject xBean)
Returns the document XmlBean that is associated with the specified XmlBean.

Parameters:
xBean - an XmlBean
Returns:
the document XmlBean that is associated with the specified XmlBean

getName

public static javax.xml.namespace.QName getName(org.apache.xmlbeans.XmlObject xBean)
Parameters:
xBean -
Returns:

getName

public static javax.xml.namespace.QName getName(org.apache.xmlbeans.XmlCursor xCursor)
Note. this method does not dispose of the cursor

Parameters:
xCursor -
Returns:

getRootElement

public static org.apache.xmlbeans.XmlObject getRootElement(org.apache.xmlbeans.XmlObject docXBean)
Returns the root element of the specified document XMLBean. If the specified XMLBean is not a document, the XMLBean itself is returned.

Parameters:
docXBean - a document XMLBean
Returns:
the root element of the specified document XMLBean, or, if the specified XMLBean is not a document, the XMLBean itself

getValue

public static java.lang.String getValue(org.apache.xmlbeans.XmlObject xBean)
Parameters:
xBean -
Returns:

getValueAsQName

public static javax.xml.namespace.QName getValueAsQName(org.apache.xmlbeans.XmlObject xBean)
Parameters:
xBean -
Returns:

setValue

public static void setValue(org.apache.xmlbeans.XmlObject xBean,
                            java.lang.String value)
Parameters:
xBean -
value -

setValueAsQName

public static void setValueAsQName(org.apache.xmlbeans.XmlObject xBean,
                                   javax.xml.namespace.QName qName)
Parameters:
xBean -
qName -

getAttributeValue

public static java.lang.String getAttributeValue(org.apache.xmlbeans.XmlObject xBean,
                                                 javax.xml.namespace.QName attribName)
Parameters:
xBean -
attribName -
Returns:

getAttributeValueAsQName

public static javax.xml.namespace.QName getAttributeValueAsQName(org.apache.xmlbeans.XmlObject xBean,
                                                                 javax.xml.namespace.QName attribName)
Parameters:
xBean -
Returns:

getXmlBeanAnyMap

public static java.util.Map getXmlBeanAnyMap(org.apache.xmlbeans.XmlObject xmlObjectToSearch)
Returns a Map keyed on Element QName to a List containing the "Any" XmlObjects types.

The way we determine that an element is an Any is by asking for the element property of the schemaType for the element by the element's QName.

Parameters:
xmlObjectToSearch - The XmlObject to find the Any elements in.
Returns:
Map keyed on Element QName to a List containing the "Any" XmlObjects

addChildElement

public static org.apache.xmlbeans.XmlObject addChildElement(org.apache.xmlbeans.XmlObject parentXBean,
                                                            org.apache.xmlbeans.XmlObject xBean)
Adds a copy of the specified XmlBean as the last child element of the specified parent XmlBean.

Parameters:
parentXBean -
xBean -

addChildElement

public static org.apache.xmlbeans.XmlObject addChildElement(org.apache.xmlbeans.XmlObject parentXBean,
                                                            javax.xml.namespace.QName name)
Adds an XmlBean with the specified name as the last of the specified parent XmlBean.

Parameters:
parentXBean -
name -

remove

public static void remove(org.apache.xmlbeans.XmlObject xBean)
Removes the specifed XMLBean from its parent element.

Parameters:
xBean - an XMLBean

removeChildElements

public static boolean removeChildElements(org.apache.xmlbeans.XmlObject xBean,
                                          javax.xml.namespace.QName name)
Removes all child elements, with the specified name, from the specified XMLBean.

Parameters:
xBean - an XMLBean
Returns:
true if all child elements, with the specified name, were successfully removed

removeChildElements

public static boolean removeChildElements(org.apache.xmlbeans.XmlObject xBean)
Removes all child elements of the specified XMLBean.

Parameters:
xBean - an XMLBean
Returns:
true if all child elements were successfully removed

toSOAPElement

public static javax.xml.soap.SOAPElement toSOAPElement(org.apache.xmlbeans.XmlObject xBean)
                                                throws java.lang.Exception
Parameters:
xBean -
Returns:
Throws:
java.lang.Exception

toSOAPElementArray

public static javax.xml.soap.SOAPElement[] toSOAPElementArray(org.apache.xmlbeans.XmlObject[] elems)
                                                       throws java.lang.Exception
DOCUMENT_ME

Parameters:
elems - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
java.lang.Exception - DOCUMENT_ME

toXmlObject

public static org.apache.xmlbeans.XmlObject toXmlObject(java.lang.Object obj)
                                                 throws java.lang.Exception
If possible, converts the specified object to an XMLBean.

Parameters:
obj - an object
Returns:
an XMLBean, or null if the parameter is null
Throws:
java.lang.Exception - if the object cannot be converted to an XMLBean

newInstance

public org.apache.xmlbeans.XmlObject newInstance(javax.xml.namespace.QName elemName)
Parameters:
elemName -
Returns:

copyXmlBean

public static org.apache.xmlbeans.XmlObject copyXmlBean(org.apache.xmlbeans.XmlObject srcXBean)
Makes and returns a copy of the specified XMLBean.

Parameters:
srcXBean - the XMLBean to be copied
Returns:
a copy of the specified XMLBean

copyXmlBeans

public static org.apache.xmlbeans.XmlObject[] copyXmlBeans(org.apache.xmlbeans.XmlObject[] srcXBeans)
Makes and returns a copy of the specified XMLBean array.

Parameters:
srcXBeans - the array of XMLBeans to be copied
Returns:
a copy of the specified XMLBean array


Copyright © 2004-2005 Apache Software Foundation. All Rights Reserved.