Class XmlObject

java.lang.Object
com.sforce.ws.bind.XmlObject
All Implemented Interfaces:
XMLizable
Direct Known Subclasses:
XmlObjectWrapper

public class XmlObject extends 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 Details

    • XmlObject

      public XmlObject()
    • XmlObject

      public XmlObject(QName name)
    • XmlObject

      public XmlObject(QName name, Object value)
  • Method Details

    • getName

      public QName getName()
    • setName

      public void setName(QName name)
    • setDefaultNamespace

      public void setDefaultNamespace(String namespace)
    • getXmlType

      public QName getXmlType()
    • getValue

      public Object getValue()
    • setValue

      public void setValue(Object value)
    • hasChildren

      public boolean hasChildren()
    • addField

      public XmlObject addField(String name, Object value)
    • setField

      public XmlObject setField(String name, 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 Iterator<XmlObject> evaluate(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(String name)
    • getField

      public Object getField(String name)
    • getChild

      public XmlObject getChild(String name)
    • getChildren

      public Iterator<XmlObject> getChildren()
    • getChildren

      public Iterator<XmlObject> getChildren(String name)
    • getTypedChildren

      public 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 String toString()
      Overrides:
      toString in class Object
    • write

      public void write(QName element, XmlOutputStream out, TypeMapper typeMapper) throws 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:
      IOException - failed to write xml
    • load

      public void load(XmlInputStream in, TypeMapper typeMapper) throws 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:
      IOException - failed to read xml
      ConnectionException - failed to read/parser/bind xml
    • loadStartTag

      protected void loadStartTag(XmlInputStream in, TypeMapper typeMapper)
    • loadAfterStartTag

      protected void loadAfterStartTag(XmlInputStream in, TypeMapper typeMapper) throws IOException, ConnectionException
      Throws:
      IOException
      ConnectionException
    • cloneFrom

      protected void cloneFrom(XmlObject source)