Class NativeXmlNode
java.lang.Object
org.eolang.jeo.representation.xmir.NativeXmlNode
- All Implemented Interfaces:
XmlNode
XML smart element.
Utility class that simplifies work with XML.
- Since:
- 0.1
-
Constructor Summary
ConstructorsConstructorDescriptionNativeXmlNode
(String xml) Constructor.NativeXmlNode
(Node parent) Constructor. -
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 an attribute exists.int
hashCode()
Get optional child node by attribute.text()
Retrieve node text content.toString()
void
validate()
Validate the node.Find elements by xpath.
-
Constructor Details
-
NativeXmlNode
Constructor.- Parameters:
xml
- XML string.
-
NativeXmlNode
Constructor.- Parameters:
parent
- Xml node.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
toString
-
children
Description copied from interface:XmlNode
Get all child nodes. -
text
Description copied from interface:XmlNode
Retrieve node text content. -
attribute
Description copied from interface:XmlNode
Get attribute. -
child
Description copied from interface:XmlNode
Get child node. -
xpath
Find elements by xpath. -
child
Description copied from interface:XmlNode
Get child node by attribute. -
optchild
Description copied from interface:XmlNode
Get optional child node by attribute. -
firstChild
Description copied from interface:XmlNode
Get first child.- Specified by:
firstChild
in interfaceXmlNode
- Returns:
- First child node.
-
hasAttribute
Description copied from interface:XmlNode
Check if an attribute exists.- Specified by:
hasAttribute
in interfaceXmlNode
- Parameters:
name
- Attribute name.value
- Attribute value.- Returns:
- True if an attribute with specified value exists.
-
validate
public void validate()Description copied from interface:XmlNode
Validate the node.
-