Class XmlNode
java.lang.Object
org.eolang.jeo.representation.xmir.XmlNode
XML smart element.
Utility class that simplifies work with XML.
- Since:
- 0.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet attribute.Get child node.Get child node by attribute.children()
Get all child nodes.boolean
Get first child.boolean
hasAttribute
(String name, String value) Check if attribute exists.int
hashCode()
node()
To XML node.Get optional child node.Get optional child node by attribute.text()
Retrieve node text content.toString()
-
Constructor Details
-
XmlNode
Constructor.- Parameters:
xml
- XML string.
-
XmlNode
Constructor.- Parameters:
parent
- Parent node.
-
-
Method Details
-
node
To XML node.- Returns:
- Xml node
-
equals
-
hashCode
public int hashCode() -
toString
-
child
Get child node.- Parameters:
name
- Child node name.- Returns:
- Child node.
-
optchild
Get optional child node.- Parameters:
name
- Child node name.- Returns:
- Child node.
-
child
Get child node by attribute.- Parameters:
attribute
- Attribute name.value
- Attribute value.- Returns:
- Child node.
-
optchild
Get optional child node by attribute.- Parameters:
attribute
- Attribute name.value
- Attribute value.- Returns:
- Child node.
-
firstChild
Get first child.- Returns:
- First child node.
-
children
Get all child nodes.- Returns:
- Child nodes.
-
text
Retrieve node text content.- Returns:
- Text content.
-
attribute
Get attribute.- Parameters:
name
- Attribute name.- Returns:
- Attribute.
-
hasAttribute
Check if attribute exists.- Parameters:
name
- Attribute name.value
- Attribute value.- Returns:
- True if attribute with specified value exists.
-