Class XmlElement
- java.lang.Object
- 
- software.amazon.awssdk.protocols.query.unmarshall.XmlElement
 
- 
 public final class XmlElement extends Object Represents an element in an XML document.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classXmlElement.BuilderBuilder forXmlElement.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>attributes()Retrieves the attributes associated with the elementstatic XmlElement.Builderbuilder()List<XmlElement>children()StringelementName()static XmlElementempty()XmlElementgetElementByName(String tagName)Retrieves a single child element by tag name.List<XmlElement>getElementsByName(String tagName)Get all child elements by the given tag name.XmlElementgetFirstChild()Optional<String>getOptionalAttributeByName(String attribute)Retrieves an optional attribute by attribute name.Optional<XmlElement>getOptionalElementByName(String tagName)Retrieves a single child element by tag name.StringtextContent()
 
- 
- 
- 
Method Detail- 
elementNamepublic String elementName() - Returns:
- Tag name of the element.
 
 - 
childrenpublic List<XmlElement> children() - Returns:
- The list of direct children of this element. May be empty.
 
 - 
getFirstChildpublic XmlElement getFirstChild() - Returns:
- The first child element of this element. Null if this element has no children.
 
 - 
getElementsByNamepublic 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.
 
 - 
getElementByNamepublic 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.
 
 - 
getOptionalElementByNamepublic 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 Optionalof XmlElement with the matching tag name or emptyOptionalif no element exists.
- Throws:
- SdkClientException- If more than one element with the given tag name is found.
 
 - 
textContentpublic String textContent() - Returns:
- Text content of this element.
 
 - 
getOptionalAttributeByNamepublic Optional<String> getOptionalAttributeByName(String attribute) Retrieves an optional attribute by attribute name.
 - 
attributespublic Map<String,String> attributes() Retrieves the attributes associated with the element
 - 
builderpublic static XmlElement.Builder builder() - Returns:
- New XmlElement.Builderinstance.
 
 - 
emptypublic static XmlElement empty() - Returns:
- An empty XmlElement(). 
 
 
- 
 
-