XmlNode
Overview
XML nodes are structured elements that support interaction and manipulation through various methods. These methods facilitate operations such as retrieving attribute names and values, accessing child nodes, obtaining the node name and type, and fetching the text value of an XML node.
Functionality
The getAttributeNames method retrieves all attribute names from the current node, while getAttributeValue returns the value of a specified attribute. To interact with node relationships, getChildNodes allows access to all child nodes. Additionally, getName provides the name of the XML node, and getType identifies its type. For textual data, getTextValue extracts the text content of the node.
Methods Summarized
Methods Detailed
getAttributeNames()
Return all the attribute names of the current node.
Returns: Array an array of attribute names for the current XML node, or an empty array if the node has no attributes.
Sample
getAttributeValue(attributeName)
Return the value of the named attribute.
Parameters
String attributeName ;
Returns: String the value of the specified attribute, or null if the attribute does not exist.
Sample
getChildNodes()
Return the child nodes of the current node.
Returns: Array an array of XmlNode objects representing the child nodes of the current XML node, or an empty array if there are no child nodes.
Sample
getName()
Return the name of the XML node element.
Returns: String the name of the XML node element.
Sample
getTextValue()
Return the text-value of the XML node element.
Returns: String the text value of the XML node element, or null if the node has no text content.
Sample
getType()
Return the type of the XML node element.
Returns: String the type of the XML node element, which can be "TEXT", "ELEMENT", or "UNKNOWN".
Sample
Last updated
Was this helpful?