Class XmlObject

  • All Implemented Interfaces:
    XMLizable
    Direct Known Subclasses:
    XmlObjectWrapper

    public class XmlObject
    extends java.lang.Object
    implements XMLizable
    This is a generic XML element -- same a DOM element. In the common case this class must be able to hold child elements. We do not have a usecase for it yet. So child elements are not implemented.
    Since:
    1.0 Dec 12, 2005
    Version:
    1.0
    Author:
    http://cheenath.com
    • Constructor Detail

      • XmlObject

        public XmlObject()
      • XmlObject

        public XmlObject​(javax.xml.namespace.QName name)
      • XmlObject

        public XmlObject​(javax.xml.namespace.QName name,
                         java.lang.Object value)
    • Method Detail

      • getName

        public javax.xml.namespace.QName getName()
      • setName

        public void setName​(javax.xml.namespace.QName name)
      • setDefaultNamespace

        public void setDefaultNamespace​(java.lang.String namespace)
      • getXmlType

        public javax.xml.namespace.QName getXmlType()
      • getValue

        public java.lang.Object getValue()
      • setValue

        public void setValue​(java.lang.Object value)
      • hasChildren

        public boolean hasChildren()
      • addField

        public XmlObject addField​(java.lang.String name,
                                  java.lang.Object value)
      • setField

        public XmlObject setField​(java.lang.String name,
                                  java.lang.Object value)
      • asTyped

        public XMLizable asTyped()
        Because we create complex types as subclasses of XMLizable instead of XmlObject (and we don't want to change interfaces), this method will return this as the complex type subclass of XMLizable, if this represents a complex type. If it does not, it will simply return this.
        Returns:
      • evaluate

        public java.util.Iterator<XmlObject> evaluate​(java.lang.String xpath)
        evaluate the given xpath like expression. eg xpath: "OpportunityContactRoles/records/Contact/LastName" this will list all LastName
        Parameters:
        xpath -
        Returns:
      • removeField

        public boolean removeField​(java.lang.String name)
      • getField

        public java.lang.Object getField​(java.lang.String name)
      • getChild

        public XmlObject getChild​(java.lang.String name)
      • getChildren

        public java.util.Iterator<XmlObject> getChildren()
      • getChildren

        public java.util.Iterator<XmlObject> getChildren​(java.lang.String name)
      • getTypedChildren

        public java.util.Iterator<XMLizable> getTypedChildren()
        Similar to asTyped(), this will return this object's children as the proper complex type subclass of XMLizable, if they are complex types. If a child is not a complex type, it will be returned as-is, as an XmlObject.
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • write

        public void write​(javax.xml.namespace.QName element,
                          XmlOutputStream out,
                          TypeMapper typeMapper)
                   throws java.io.IOException
        Description copied from interface: XMLizable
        write this instace as xml.
        Specified by:
        write in interface XMLizable
        Parameters:
        element - xml element name
        out - xml output stream
        typeMapper - type mapper to be used
        Throws:
        java.io.IOException - failed to write xml
      • load

        public void load​(XmlInputStream in,
                         TypeMapper typeMapper)
                  throws java.io.IOException,
                         ConnectionException
        Description copied from interface: XMLizable
        load the fileds/children from the specified xml stream
        Specified by:
        load in interface XMLizable
        Parameters:
        in - xml input stream from which the data is read
        typeMapper - type mapper to be used
        Throws:
        java.io.IOException - failed to read xml
        ConnectionException - failed to read/parser/bind xml
      • cloneFrom

        protected void cloneFrom​(XmlObject source)