Class XpathCommon

    • Constructor Detail

      • XpathCommon

        public XpathCommon()
    • Method Detail

      • selectSingleNode

        protected final org.w3c.dom.Node selectSingleNode​(org.w3c.dom.Node document)
                                                   throws XpathCommonException
        Returns result of getXpath() from input parameter.

        Example:

        Payload:
        <root><key>value</key></root>

        Xpath:
        /root/key

        Node:
        value

        Parameters:
        document - Xml to run xpath against
        Returns:
        resulting node from xpath query
        Throws:
        XpathCommonException - wraps thrown exceptions
      • selectSingleNode

        public final org.w3c.dom.Node selectSingleNode​(java.lang.String input)
                                                throws XpathCommonException
        Convenience method that calls selectSingleNode(Node) after turning string into node.
        Parameters:
        input - Xml to run xpath against
        Returns:
        resulting node from xpath query
        Throws:
        XpathCommonException - wraps thrown exceptions
      • nodeToString

        public final java.lang.String nodeToString​(org.w3c.dom.Node node)
                                            throws XpathCommonException
        Utility class that returns a String of a Node
        Parameters:
        node - node to transform
        Returns:
        string of node
        Throws:
        XpathCommonException - wraps thrown exceptions
      • selectSingleBoolean

        protected final boolean selectSingleBoolean​(java.lang.String input)
                                             throws XpathCommonException
        Returns boolean result of getXpath() against input param.

        Example:

        Payload:
        <root><key>value</key></root>

        Xpath:
        count(/root/key) = 1

        Parameters:
        input - Xml to run xpath against
        Returns:
        Boolean result of xpath
        Throws:
        XpathCommonException - wraps thrown exceptions
      • getXpath

        public java.lang.String getXpath()
        Returns the xpath to use.
        Returns:
        the xpath
      • setXpath

        public void setXpath​(java.lang.String xpath)
        Sets the xpath to use.
        Parameters:
        xpath - the xpath
      • getNamespaceContext

        public KeyValuePairSet getNamespaceContext()
        Returns:
        the namespaceContext