Class XmlElement


  • public final class XmlElement
    extends Object
    Represents an element in an XML document.
    • Method Detail

      • elementName

        public String elementName()
        Returns:
        Tag name of the element.
      • children

        public List<XmlElement> children()
        Returns:
        The list of direct children of this element. May be empty.
      • getFirstChild

        public XmlElement getFirstChild()
        Returns:
        The first child element of this element. Null if this element has no children.
      • getElementsByName

        public List<XmlElement> getElementsByName​(String tagName)
        Get all child elements by the given tag name. This only returns direct children elements.
        Parameters:
        tagName - Tag name of elements to retrieve.
        Returns:
        List of elements or empty list of no elements found with given name.
      • getElementByName

        public XmlElement getElementByName​(String tagName)
        Retrieves a single child element by tag name. If more than one element is found then this method will throw an exception.
        Parameters:
        tagName - Tag name of element to get.
        Returns:
        XmlElement with the matching tag name or null if no element exists.
        Throws:
        SdkClientException - If more than one element with the given tag name is found.
      • getOptionalElementByName

        public Optional<XmlElement> getOptionalElementByName​(String tagName)
        Retrieves a single child element by tag name. If more than one element is found then this method will throw an exception.
        Parameters:
        tagName - Tag name of element to get.
        Returns:
        Fulfilled Optional of XmlElement with the matching tag name or empty Optional if no element exists.
        Throws:
        SdkClientException - If more than one element with the given tag name is found.
      • textContent

        public String textContent()
        Returns:
        Text content of this element.
      • getOptionalAttributeByName

        public Optional<String> getOptionalAttributeByName​(String attribute)
        Retrieves an optional attribute by attribute name.
      • attributes

        public Map<String,​String> attributes()
        Retrieves the attributes associated with the element