Class JcabiXmlNode

  • All Implemented Interfaces:
    XmlNode

    public final class JcabiXmlNode
    extends Object
    implements XmlNode
    Jcabi XML node.
    Since:
    0.8
    • Method Detail

      • children

        public Stream<XmlNode> children()
        Description copied from interface: XmlNode
        Get all child nodes.
        Specified by:
        children in interface XmlNode
        Returns:
        Child nodes.
      • text

        public String text()
        Description copied from interface: XmlNode
        Retrieve node text content.
        Specified by:
        text in interface XmlNode
        Returns:
        Text content.
      • attribute

        public Optional<String> attribute​(String name)
        Description copied from interface: XmlNode
        Get attribute.
        Specified by:
        attribute in interface XmlNode
        Parameters:
        name - Attribute name.
        Returns:
        Attribute.
      • child

        public XmlNode child​(String name)
        Description copied from interface: XmlNode
        Get child node.
        Specified by:
        child in interface XmlNode
        Parameters:
        name - Child node name.
        Returns:
        Child node.
      • xpath

        public List<String> xpath​(String xpath)
        Description copied from interface: XmlNode
        Find elements by xpath.
        Specified by:
        xpath in interface XmlNode
        Parameters:
        xpath - XPath.
        Returns:
        List of elements.
      • child

        public XmlNode child​(String attribute,
                             String value)
        Description copied from interface: XmlNode
        Get child node by attribute.
        Specified by:
        child in interface XmlNode
        Parameters:
        attribute - Attribute name.
        value - Attribute value.
        Returns:
        Child node.
      • optchild

        public Optional<XmlNode> optchild​(String attribute,
                                          String value)
        Description copied from interface: XmlNode
        Get optional child node by attribute.
        Specified by:
        optchild in interface XmlNode
        Parameters:
        attribute - Attribute name.
        value - Attribute value.
        Returns:
        Child node.
      • firstChild

        public XmlNode firstChild()
        Description copied from interface: XmlNode
        Get first child.
        Specified by:
        firstChild in interface XmlNode
        Returns:
        First child node.
      • hasAttribute

        public boolean hasAttribute​(String name,
                                    String value)
        Description copied from interface: XmlNode
        Check if an attribute exists.
        Specified by:
        hasAttribute in interface XmlNode
        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.
        Specified by:
        validate in interface XmlNode