Package com.sforce.ws.bind
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlObjectaddField(String name, Object value)XMLizableasTyped()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.protected voidcloneFrom(XmlObject source)Iterator<XmlObject>evaluate(String xpath)evaluate the given xpath like expression.XmlObjectgetChild(String name)Iterator<XmlObject>getChildren()Iterator<XmlObject>getChildren(String name)ObjectgetField(String name)QNamegetName()Iterator<XMLizable>getTypedChildren()Similar toasTyped(), this will return this object's children as the proper complex type subclass of XMLizable, if they are complex types.ObjectgetValue()QNamegetXmlType()booleanhasChildren()voidload(XmlInputStream in, TypeMapper typeMapper)load the fileds/children from the specified xml streamprotected voidloadAfterStartTag(XmlInputStream in, TypeMapper typeMapper)protected voidloadStartTag(XmlInputStream in, TypeMapper typeMapper)booleanremoveField(String name)voidsetDefaultNamespace(String namespace)XmlObjectsetField(String name, Object value)voidsetName(QName name)voidsetValue(Object value)StringtoString()voidwrite(QName element, XmlOutputStream out, TypeMapper typeMapper)write this instace as xml.
-
-
-
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()
-
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)
-
getTypedChildren
public Iterator<XMLizable> getTypedChildren()
Similar toasTyped(), 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:
-
write
public void write(QName element, XmlOutputStream out, TypeMapper typeMapper) throws IOException
Description copied from interface:XMLizablewrite this instace as xml.- Specified by:
writein interfaceXMLizable- Parameters:
element- xml element nameout- xml output streamtypeMapper- 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:XMLizableload the fileds/children from the specified xml stream- Specified by:
loadin interfaceXMLizable- Parameters:
in- xml input stream from which the data is readtypeMapper- type mapper to be used- Throws:
IOException- failed to read xmlConnectionException- 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:
IOExceptionConnectionException
-
cloneFrom
protected void cloneFrom(XmlObject source)
-
-