Code example for XPathExpression

Methods: evaluate

  public String getPackage() {
    try { 
      return (String) packageExpression.evaluate(doc, XPathConstants.STRING);
    } catch (XPathExpressionException e) {
      throw Throwables.propagate(e);
   * This allows querying the AndroidManifest for e.g. attributes like android:name using XPath 
  private static NamespaceContext androidNamespaceContext = new NamespaceContext() {
    public Iterator<String> getPrefixes(String namespaceURI) { 
      throw new UnsupportedOperationException(); 
Stop searching for code, let great code find you!  Add Codota to your java IDE