Set an XPath
A very simple subset of xpath is supported to select a partial
tree.  Currently only path like "/node1/nodeA | /node1/nodeB"
are supported.
@param xpath The xpath to set.
495693
public void setXpath(String xpath)
    {
        _xpath = xpath;
        StringTokenizer tok = new StringTokenizer(xpath,"| ");
        while(tok.hasMoreTokens())
            _xpaths=LazyList.add(_xpaths, tok.nextToken());
    }
461781
def set_input_by_xpath(self, xpath, value):
        

        elem = self.select(xpath).node()

        if self._lxml_form is None:
            # Explicitly set the default form
            # which contains found element
            parent = elem
            while True:
                parent = parent.getparent() # pylint: disable=no-member
                if parent.tag == 'form':
                    self._lxml_form = parent
                    break

        # pylint: disable=no-member
        return self.set_input(elem.get('name'), value)
1005635
private void textPath(Attributes attributes) throws SVGParseException
   {
      debug("<textPath>");

      if (currentElement == null)
         throw new SVGParseException("Invalid document. Root element must be <svg>");
      SVG.TextPath  obj = new SVG.TextPath();
      obj.document = svgDocument;
      obj.parent = currentElement;
      parseAttributesCore(obj, attributes);
      parseAttributesStyle(obj, attributes);
      parseAttributesConditional(obj, attributes);
      parseAttributesTextPath(obj, attributes);
      currentElement.addChild(obj);
      currentElement = obj;
      if (obj.parent instanceof TextRoot)
         obj.setTextRoot((TextRoot) obj.parent);
      else
         obj.setTextRoot(((TextChild) obj.parent).getTextRoot());
   }
569619
public function setXML(&$xml)
	{
		if (is_object($xml))
		{
			if ($group = $xml['group'])
			{
				$this->_xml[(string) $group] = $xml;
			}
			else
			{
				$this->_xml['_default'] = $xml;
			}

			if ($dir = $xml['addpath'])
			{
				$this->addElementPath(PATH_ROOT . str_replace('/', DS, (string) $dir));
			}
		}
	}
502047
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setContainer(WebLocator container) {
        this.container = container;
        return (T) this;
    }
592972
public static Node asNode(String nodeName, Node node, XPath xpath)
            throws XPathExpressionException {
        if (node == null) return null;
        return (Node) xpath.evaluate(nodeName, node, XPathConstants.NODE);
    }
1224451
public void xml(String xml) {
    if (LogLevel.DEBUG < logConfiguration.logLevel) {
      return;
    }
    printlnInternal(LogLevel.DEBUG, logConfiguration.xmlFormatter.format(xml));
  }
1020594
static public void visitElements( XMLNode root, String path, ElementVisitor ev )
    {
        // Get last element in path
        int idx = path.lastIndexOf( '<' );
        String head = path.substring( 0, idx );
        String tag = path.substring( idx + 1, path.length() - 1 );

        XMLNode elem = findElementPath( root, head );
        if ( elem == null )
        {
            return;
        }

        // Iterate through all child nodes
        XMLNode n = elem.getNested();
        while ( n != null )
        {
            if ( n.isElement() && n.getName().equals( tag ) )
            {
                ev.visitElement( n );
            }
            n = n.getNext();
        }
    }
1028854
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setName(final String name) {
        this.name = name;
        return (T) this;
    }
168281
private @Nonnull NodeList evaluate(String xpath) {
        try {
            XPathExpression expr = xpf.newXPath().compile(xpath);
            return (NodeList) expr.evaluate(node, XPathConstants.NODESET);
        } catch (XPathExpressionException ex) {
            throw new IllegalArgumentException("Invalid XPath '" + xpath + "'", ex);
        }
    }
54867
public ValueAssert valueByXPath(String xPath) {
        isNotNull();
        try {
            return ValueAssert.create(actual, prefix2Uri, dbf, xpf, xPath);
        } catch (Exception e) {
            throwAssertionError(shouldNotHaveThrown(e));
        }
        return null; //fix compile issue
    }
1041078
protected static void setSelected(TreeElement node, String selected, ServletRequest request)
    {
        assert(node != null) : "parameter 'node' must not be null";
        assert(selected != null) : "parameter 'selected' must not be null";
        assert(request != null) : "parameter 'requested' must not be null";

        if (node.getName().equals(selected)) {
            node.onSelect(request);
            node.setSelected(true);
        }
        else {
            if (node.isSelected()) {
                node.onSelect(request);
                node.setSelected(false);
            }
        }

        TreeElement children[] = node.getChildren();
        assert(children != null);
        for (int i = 0; i < children.length; i++) {
            setSelected(children[i], selected, request);
        }
    }
776476
public static Node getElementB(Node node, XPathExpression xPath) throws XPathExpressionException {
        return getElementsB(node, xPath).item(0);
    }
344958
public static Node selectSingleNode(Node node, String xpathQuery, Map<String, String> namespaceUris) {
        XPath xpath = DocumentHelper.createXPath(xpathQuery);
        xpath.setNamespaceURIs(namespaceUris);

        return xpath.selectSingleNode(node);
    }
117532
public void setAuxAnalyzepath(Path src) {
        boolean nonEmpty = false;

        String[] elementList = src.list();
        for (String anElementList : elementList) {
            if (!"".equals(anElementList)) {
                nonEmpty = true;
                break;
            }
        }

        if (nonEmpty) {
            if (auxAnalyzepath == null) {
                auxAnalyzepath = src;
            } else {
                auxAnalyzepath.append(src);
            }
        }
    }
284975
private void setXPathCharacteristics(IdentifierImpl identifier)
    throws InvalidXPathSyntaxException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass,
               "setXPathCharacteristics",
               "identifier: " + identifier);
    
    // Need to set the domain to XPATH1.0
    identifier.setSelectorDomain(2);

    // Set the locationStep also
    identifier.setStep(locationStep);
    
    // Call XPath to compile the XPath1.0 expression and store the
    // resultant XPathExpression in the Identifier.
    XPathExpression xpexp = null;
    
    try
    {
      // Parse an expression up-front
      Node node = null;
      NodeList ns = null;
      XPath xpath0 = XPathFactory.newInstance().newXPath();
      
      // If a namespace context has been set then set it into the XPath env
      if(namespaceContext != null)
        xpath0.setNamespaceContext(namespaceContext);
      
      xpexp = xpath0.compile(identifier.getName());
    }
    catch (Exception ex)
    {
      // No FFDC Code Needed.
      // We don't FFDC because we'll catch this exception and then attempt
      // to parse the entire expression. If that fails, then we FFDC.
 
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        tc.exit(this,cclass, "setXPathCharacteristics", ex);   
     
      throw new InvalidXPathSyntaxException(identifier.getName());
    }

    // Store xpexp in the Identifier    
    identifier.setCompiledExpression(xpexp);
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "setXPathCharacteristics");     
  }
530012
public NodeList get(String xPath) throws Exception {
		XPathQuery xp = new XPathQuery(xPath);
		return xp.eval(this);
	}