XPath+Java Test

public void testCFBundleVersionFormat() 
  throws XPathExpressionException {
       
    String regex = "\\d+\\.\\d+(\\.\\d+)?";
    String xpath = "//key[. = 'CFBundleVersion']/following-sibling::string[1]";
      
    String version = (String) query.evaluate(xpath, plist, XPathConstants.STRING);
      
    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(version);
    assertTrue(matcher.matches());
      
}

Previous | Next | Top | Cafe con Leche

Copyright 2005-2007 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified August 17, 2005