XmlNode Class
Namespace
XmlNode Methods
The following are methods for XmlNode. All are instance methods.
addChildElement(name, namespace, prefix)
Signature
public Dom.XmlNode addChildElement(String name, String namespace, String prefix)
Parameters
Return Value
Type: Dom.XmlNode
Usage
- If the namespace argument has a non-null value and the prefix argument is null, the namespace is set as the default namespace.
- If the prefix argument is null, Salesforce automatically assigns a prefix for the element. The format of the automatic prefix is nsi, where i is a number.If the prefix argument is '', the namespace is set as the default namespace.
addCommentNode(text)
Signature
public Dom.XmlNode addCommentNode(String text)
Parameters
- text
- Type: String
- The text argument can't have a null value.
Return Value
Type: Dom.XmlNode
addTextNode(text)
Signature
public Dom.XmlNode addTextNode(String text)
Parameters
- text
- Type: String
- The text argument can't have a null value.
Return Value
Type: Dom.XmlNode
getAttribute(key, keyNamespace)
Signature
public String getAttribute(String key, String keyNamespace)
Return Value
Type: String
getAttributeCount()
Signature
public Integer getAttributeCount()
Return Value
Type: Integer
getAttributeValue(key, keyNamespace)
Signature
public String getAttributeValue(String key, String keyNamespace)
Return Value
Type: String
Example
For example, for the <xyz a:b="c:d" /> element:
- getAttribute returns c:d
- getAttributeValue returns d
getChildElement(name, namespace)
Signature
public Dom.XmlNode getChildElement(String name, String namespace)
Return Value
Type: Dom.XmlNode
getChildElements()
Signature
public Dom.XmlNode[] getChildElements()
Return Value
Type: Dom.XmlNode[]
getChildren()
Signature
public Dom.XmlNode[] getChildren()
Return Value
Type: Dom.XmlNode[]
getNamespace()
Signature
public String getNamespace()
Return Value
Type: String
getNodeType()
Signature
public Dom.XmlNodeType getNodeType()
Return Value
Type: Dom.XmlNodeType
Uses XmlNodeType enum to return COMMENT, ELEMENT, or TEXT as the node type.
getParent()
Signature
public Dom.XmlNode getParent()
Return Value
Type: Dom.XmlNode
insertBefore(newChild, refChild)
Signature
public Dom.XmlNode insertBefore(Dom.XmlNode newChild, Dom.XmlNode refChild)
Parameters
- newChild
- Type: Dom.XmlNode
- The node to insert.
- refChild
- Type: Dom.XmlNode
- The node before the new node.
Return Value
Type: Dom.XmlNode
Usage
- If refChild is null, newChild is inserted at the end of the list.
- If refChild doesn't exist, an exception is thrown.
removeChild(childNode)
Signature
public Boolean removeChild(Dom.XmlNode childNode)
Parameters
- childNode
- Type: Dom.XmlNode
Return Value
Type: Boolean