com.sforce.ws.bind
Class XmlObject

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

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 Summary
XmlObject()
           
XmlObject(QName name)
           
XmlObject(QName name, Object value)
           
 
Method Summary
 XmlObject addField(String name, Object value)
           
 Iterator<XmlObject> evaluate(String xpath)
          evaluate the given xpath like expression.
 XmlObject getChild(String name)
           
 Iterator<XmlObject> getChildren()
           
 Iterator<XmlObject> getChildren(String name)
           
 Object getField(String name)
           
 QName getName()
           
 Object getValue()
           
 QName getXmlType()
           
 boolean hasChildren()
           
 void load(XmlInputStream in, TypeMapper typeMapper)
          load the fileds/children from the specified xml stream
protected  void loadAfterStartTag(XmlInputStream in, TypeMapper typeMapper)
           
protected  void loadStartTag(XmlInputStream in, TypeMapper typeMapper)
           
 boolean removeField(String name)
           
 void setDefaultNamespace(String namespace)
           
 XmlObject setField(String name, Object value)
           
 void setName(QName name)
           
 void setValue(Object value)
           
 Map<String,Object> toMap()
           
 String toString()
           
 void write(QName element, XmlOutputStream out, TypeMapper typeMapper)
          write this instace as xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlObject

public XmlObject()

XmlObject

public XmlObject(QName name)

XmlObject

public XmlObject(QName name,
                 Object value)
Method Detail

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)

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)

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

toMap

public Map<String,Object> toMap()


Copyright © 2012. All Rights Reserved.