Class XmlNode
- java.lang.Object
-
- org.eolang.jeo.representation.xmir.XmlNode
-
public final class XmlNode extends Object
XML smart element. Utility class that simplifies work with XML.- Since:
- 0.1
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>attribute(String name)Get attribute.XmlNodechild(String name)Get child node.XmlNodechild(String attribute, String value)Get child node by attribute.Stream<XmlNode>children()Get all child nodes.booleanequals(Object obj)XmlNodefirstChild()Get first child.booleanhasAttribute(String name, String value)Check if attribute exists.inthashCode()Nodenode()To XML node.Optional<XmlNode>optchild(String name)Get optional child node.Optional<XmlNode>optchild(String attribute, String value)Get optional child node by attribute.Stringtext()Retrieve node text content.StringtoString()
-
-
-
Method Detail
-
node
public Node node()
To XML node.- Returns:
- Xml node
-
child
public XmlNode child(String name)
Get child node.- Parameters:
name- Child node name.- Returns:
- Child node.
-
optchild
public Optional<XmlNode> optchild(String name)
Get optional child node.- Parameters:
name- Child node name.- Returns:
- Child node.
-
child
public XmlNode child(String attribute, String value)
Get child node by attribute.- Parameters:
attribute- Attribute name.value- Attribute value.- Returns:
- Child node.
-
optchild
public Optional<XmlNode> optchild(String attribute, String value)
Get optional child node by attribute.- Parameters:
attribute- Attribute name.value- Attribute value.- Returns:
- Child node.
-
firstChild
public XmlNode firstChild()
Get first child.- Returns:
- First child node.
-
text
public String text()
Retrieve node text content.- Returns:
- Text content.
-
attribute
public Optional<String> attribute(String name)
Get attribute.- Parameters:
name- Attribute name.- Returns:
- Attribute.
-
-