Class XmlXpathUtilites


  • public class XmlXpathUtilites
    extends Object
    Ulities class for xpath handling on a jdom document object
    Author:
    Russell Petty (GeoScience Victoria)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int countXPathNodes​(NamespaceSupport ns, String xpathString, Document doc)  
      static String getSingleXPathValue​(NamespaceSupport ns, String xpathString, Document doc)  
      static List<String> getXPathValues​(NamespaceSupport ns, String xpathString, Document doc)  
      static String removeIndexes​(String xpath)
      Remove indexes from an xpath string.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlXpathUtilites

        public XmlXpathUtilites()
    • Method Detail

      • getXPathValues

        public static List<String> getXPathValues​(NamespaceSupport ns,
                                                  String xpathString,
                                                  Document doc)
        Parameters:
        ns - namespaces
        xpathString - xpath to search on
        doc - xml to search
        Returns:
        a list of values matching the xpath in the xml supplied
      • countXPathNodes

        public static int countXPathNodes​(NamespaceSupport ns,
                                          String xpathString,
                                          Document doc)
        Parameters:
        ns - namespaces
        xpathString - xpath to search on
        doc - xml to search
        Returns:
        count of the values matching the xpath passed in
      • getSingleXPathValue

        public static String getSingleXPathValue​(NamespaceSupport ns,
                                                 String xpathString,
                                                 Document doc)
        Parameters:
        ns - namespaces
        xpathString - xpath to search on
        doc - xml to search
        Returns:
        the (single) value matching the xpath in the xml supplied
      • removeIndexes

        public static String removeIndexes​(String xpath)
        Remove indexes from an xpath string.
        Parameters:
        xpath - xpath string
        Returns:
        unindexed xpath string