Package org.dom4j

Examples of org.dom4j.XPath


            xPath.append("/branch[@relURI='").append(st.nextToken()).append("']");
        }

        getLogger().debug("XPATH: " + xPath);

        XPath xpathSelector = DocumentHelper.createXPath(xPath.toString());
        List nodes = xpathSelector.selectNodes(doc);

        if (nodes.isEmpty()) {
            getLogger().error(".act(): No nodes: " + xPath);
            getLogger().error(".act(): No child added!");
            return false;
View Full Code Here


  }

  private int[] extractBoxConstraint(Element root) {
    int[] result = new int[4];
    String nodeName = currentToken.getNode().getName();
    XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']");
    Element node = (Element) xPath.selectSingleNode(root);
    result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue();
    result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue();
    result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue();
    result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue();
    return result;
View Full Code Here

  }

  private int[] extractBoxConstraint(Element root, Token token) {
      int[] result = new int[4];
      String nodeName = token.getNode().getName();
      XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']");
      Element node = (Element) xPath.selectSingleNode(root);
      result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue();
      result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue();
      result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue();
      result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue();
      return result;
View Full Code Here

        }
    }

    private XPath createXPath( String xpathExpr )
    {
        XPath xpath = document.createXPath( xpathExpr );
        if ( !this.namespaceMap.isEmpty() )
        {
            xpath.setNamespaceURIs( this.namespaceMap );
        }
        return xpath;
    }
View Full Code Here

    }

    public boolean hasElement( String xpathExpr )
        throws XMLException
    {
        XPath xpath = createXPath( xpathExpr );
        Object evaluated = xpath.selectSingleNode( document );

        if ( evaluated == null )
        {
            return false;
        }
View Full Code Here

    }

    public String getElementText( Node context, String xpathExpr )
        throws XMLException
    {
        XPath xpath = createXPath( xpathExpr );
        Object evaluated = xpath.selectSingleNode( context );

        if ( evaluated == null )
        {
            return null;
        }
View Full Code Here

    }

    public String getElementText( String xpathExpr )
        throws XMLException
    {
        XPath xpath = createXPath( xpathExpr );
        Object evaluated = xpath.selectSingleNode( document );

        if ( evaluated == null )
        {
            return null;
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    public List<Element> getElementList( String xpathExpr )
        throws XMLException
    {
        XPath xpath = createXPath( xpathExpr );
        Object evaluated = xpath.evaluate( document );

        if ( evaluated == null )
        {
            return null;
        }
View Full Code Here

    }

    public Element getElement( String xpathExpr )
        throws XMLException
    {
        XPath xpath = createXPath( xpathExpr );
        Object evaluated = xpath.selectSingleNode( document );

        if ( evaluated == null )
        {
            return null;
        }
View Full Code Here

                xpathResult = dom4jDoc.valueOf(pattern);
            }
            else
            {
                // create an xpath expression with namespaces and evaluate it
                XPath xpath = DocumentHelper.createXPath(pattern);
                xpath.setNamespaceURIs(namespaces);
                xpathResult = xpath.valueOf(dom4jDoc);
            }
        }
        // Payload is a Java object
        else
        {
View Full Code Here

TOP

Related Classes of org.dom4j.XPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.