XPath.setNamespaceURIs
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.dom4j.XPath.setNamespaceURIs(Showing top 9 results out of 315)

  • Common ways to obtain XPath
private void myMethod () {
XPath x =
  • String xpathExpression;DocumentHelper.createXPath(xpathExpression)
  • DocumentFactory documentFactory;documentFactory.createXPath(xpathExpression)
  • DocumentHelper documentHelper;documentHelper.getDocumentFactory().createXPath(xpathExpression)
  • AI code suggestions by Codota
}
origin: apache/archiva

private XPath createXPath( String xpathExpr )
{
  XPath xpath = document.createXPath( xpathExpr );
  if ( !this.namespaceMap.isEmpty() )
  {
    xpath.setNamespaceURIs( this.namespaceMap );
  }
  return xpath;
}
origin: pentaho/pentaho-kettle

@SuppressWarnings( "unchecked" )
private boolean applyXPath() {
 try {
  XPath xpath = data.document.createXPath( data.PathValue );
  if ( meta.isNamespaceAware() ) {
   xpath = data.document.createXPath( addNSPrefix( data.PathValue, data.PathValue ) );
   xpath.setNamespaceURIs( data.NAMESPACE );
  }
  // get nodes list
  data.an = xpath.selectNodes( data.document );
  data.nodesize = data.an.size();
  data.nodenr = 0;
 } catch ( Exception e ) {
  logError( BaseMessages.getString( PKG, "GetXMLData.Log.ErrorApplyXPath", e.getMessage() ) );
  return false;
 }
 return true;
}
origin: com.lyncode/test-support

@Override
public boolean matches(Object o) {
  if (o instanceof String) {
    String input = (String) o;
    try {
      Document document = DocumentHelper.parseText(input);
      XPath xPath = document.createXPath(this.expression);
      if (this.namespaces != null)
        xPath.setNamespaceURIs(this.namespaces.build());
      String evaluatedValue = xPath.valueOf(document);
      return !xPath.selectNodes(document).isEmpty() && value.matches(evaluatedValue);
    } catch (DocumentException e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }
  System.err.println("Incorrect input");
  return false;
}
origin: igniterealtime/Openfire

/**
 * Search the specified document for Nodes corresponding to the xpath Keep
 * in mind that you have to use xmpp namespace for searching
 * Predefined namespaces: 
 *     jabber:iq:roster        //roster:*
 *     jabber:iq:register        //register:*
 *     http://jabber.org/protocol/disco#info            //disco/*
 * e.g
 * '//roster:features'
 * 
 * @param doc
 *            document
 * @param xpath
 *            with roster namespace for searching in query nodes
 * @return list of nodes found by xpath expression
 */
@SuppressWarnings("unchecked")
public static List<Node> findNodesInDocument(Document doc, String xpath)
{
  Map<String, String> namespaceUris = new HashMap<String, String>();
  namespaceUris.put("roster", "jabber:iq:roster");
  namespaceUris.put("discoitems", "http://jabber.org/protocol/disco#items");
  namespaceUris.put("register", "jabber:iq:register");
  namespaceUris.put("disco", "http://jabber.org/protocol/disco#info");
  XPath xPath = DocumentHelper.createXPath(xpath);
  xPath.setNamespaceURIs(namespaceUris);
  return xPath.selectNodes(doc);
}
origin: com.lyncode/test-support

@Override
public boolean matches(Object o) {
  if (o instanceof String) {
    String input = (String) o;
    try {
      Document document = DocumentHelper.parseText(input);
      XPath xPath = document.createXPath(this.expression);
      if (this.contexts != null) {
        xPath.setNamespaceURIs(this.contexts.build());
      }
      List<Node> list = xPath.selectNodes(document);
      boolean contains = !list.isEmpty();
      return contains;
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }
  return false;
}
origin: Alfresco/community-edition-old

Map<String,String> uris = new HashMap<String,String>();
uris.put(ATOM_NS_PREFIX, ATOM_NS_URI);
xpath.setNamespaceURIs(uris);
origin: org.alfresco.surf/spring-webscripts-api

Map<String,String> uris = new HashMap<String,String>();
uris.put("ws", "http://www.alfresco.org/webscript/1.0");
xpath.setNamespaceURIs(uris);
List nodes = xpath.selectNodes(rootElement);
if (nodes.size() == 0)
origin: pentaho/pentaho-kettle

xpathField.setNamespaceURIs( data.NAMESPACE );
if ( xmlDataField.getResultType() == GetXMLDataField.RESULT_TYPE_VALUE_OF ) {
 nodevalue = xpathField.valueOf( node );
origin: org.springframework.extensions.surf/spring-webscripts-api

Map<String,String> uris = new HashMap<String,String>();
uris.put("ws", "http://www.alfresco.org/webscript/1.0");
xpath.setNamespaceURIs(uris);
List nodes = xpath.selectNodes(rootElement);
if (nodes.size() == 0)
org.dom4jXPathsetNamespaceURIs

Javadoc

Sets the current NamespaceContext from a Map where the keys are the String namespace prefixes and the values are the namespace URIs.

For example:

 
Map uris = new HashMap(); 
uris.put("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); 
uris.put("m", "urn:xmethodsBabelFish"); 
XPath xpath = document 
.createXPath("SOAP-ENV:Envelope/SOAP-ENV:Body/m:BabelFish"); 
xpath.setNamespaceURIs(uris); 
Node babelfish = xpath.selectSingleNode(document); 

Popular methods of XPath

  • selectNodes
    selectNodes evaluates the XPath expression on the given Nodeor Listof Nodes and returns the result a
  • selectSingleNode
    selectSingleNode evaluates this XPath expression on the given Nodeor Listof Nodes and returns the re
  • valueOf
    valueOf evaluates this XPath expression and returns the textual representation of the results using
  • evaluate
    evaluate evaluates an XPath expression and returns the result as an Object. The object returned can
  • numberValueOf
    numberValueOf evaluates an XPath expression and returns the numeric value of the XPath expression if
  • setVariableContext
    Sets the variable context to be used when evaluating XPath expressions
  • sort
    sort sorts the given List of Nodes using this XPath expression as a java.util.Comparatorand optional
  • setNamespaceContext
    Sets the namespace context to be used when evaluating XPath expressions
  • getText
    getText will return the textual version of the XPath expression.
  • setFunctionContext
    Sets the function context to be used when evaluating XPath expressions
  • booleanValueOf
    Retrieve a boolean-value interpretation of this XPath expression when evaluated against a given cont
  • matches
    matches returns true if the given node matches the XPath expression. To be more precise when evaluat
  • booleanValueOf,
  • matches

Popular classes and methods

  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Window (java.awt)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SortedMap (java.util)
    A Map that further provides a total ordering on its keys. The map is ordered according to the Compar
  • JFileChooser (javax.swing)

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)