Package org.jaxen

Examples of org.jaxen.XPath.selectSingleNode()


    Map<String,String> namespaces,
    Map<QName,Function> functions,
    Map<QName,Object> variables) throws XPathException {
    try {
      XPath xpath = getXPath(path, namespaces, functions, variables);
      return xpath.selectSingleNode(base);
    } catch (JaxenException e) {
      throw new XPathException(e);
    }
  }
 
View Full Code Here


            map.put("default", XmlConstants.POM_DEFAULT_NAMESPACE);

            XPath xpath = new Dom4jXPath("/default:project/default:dependencies");
            xpath.setNamespaceContext(new SimpleNamespaceContext(map));
           
            dependenciesNode = (DefaultElement)xpath.selectSingleNode(pomDocument);
            readDependenciesListFromXmlNode(dependencies, dependenciesNode);
        }
        catch (JaxenException e) {
            e.printStackTrace();
        }
View Full Code Here

   
    public static void loadSettingsSection(final String xPathString, final Object parent,
            final DeployerSettings deployerSettings) throws JaxenException {
       
        XPath xpath = new Dom4jXPath(xPathString);
        Node settings = (Node)xpath.selectSingleNode(parent);
       
        if (null != settings) {
            deployerSettings.useIndex = XmlUtils.getChildNodeBooleanValue(settings,
                    XmlConstants.USE_INDEX, deployerSettings.useIndex);
        }
View Full Code Here

                    prefix += "default:";
                }
                XPath xpath = new Dom4jXPath(prefix + childName);
                xpath.setNamespaceContext(new SimpleNamespaceContext(map));

                Node child = (Node) xpath.selectSingleNode(parent);
                if (null != child) {
                    if (null != child.getText()) {
                        result = child.getText().trim();
                    }
                }
View Full Code Here

    @Override
    public Node evaluateAsNode(String expression, Source context) throws XPathException {
        try {
            XPath xpath = createXPath(expression);
            Element element = getRootElement(context);
            return (Node) xpath.selectSingleNode(element);
        }
        catch (JaxenException ex) {
            throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
        }
        catch (TransformerException ex) {
View Full Code Here

    @Override
    public <T> T evaluateAsObject(String expression, Source context, NodeMapper<T> nodeMapper) throws XPathException {
        try {
            XPath xpath = createXPath(expression);
            Element element = getRootElement(context);
            Node node = (Node) xpath.selectSingleNode(element);
            if (node != null) {
                try {
                    return nodeMapper.mapNode(node, 0);
                }
                catch (DOMException ex) {
View Full Code Here

                XPath xpath = new JDOMXPath("//" +
                                            NAMESPACE_PREFIX + ":" +
                                            MSS_CONFIG_MESSAGESTORE_ELEMENT);
                xpath.setNamespaceContext(nsContext);

                Element element = (Element) xpath.selectSingleNode(root);

                // Location
                config.setLocation(element.getAttributeValue(
                        MSS_CONFIG_LOCATION_ATTRIBUTE));
View Full Code Here

                xpath = new JDOMXPath("//" +
                                      NAMESPACE_PREFIX + ":" +
                                      MSS_CONFIG_ENVIRONMENT_ELEMENT);
                xpath.setNamespaceContext(nsContext);

                element = (Element) xpath.selectSingleNode(root);
                config.setLog4jConfigurationFile(
                        element.getAttributeValue(MSS_CONFIG_LOG4J_ATTRIBUTE));
            } else {
                handleConfigError(null);
            }
View Full Code Here

    Element returnResult = ((Document)domResult.getNode())
        .getDocumentElement();

    XPath xpath = new DOMXPath("/BLUB/root/element1");
    Element element1
        = (Element)xpath.selectSingleNode(returnResult);
    String value1 = element1.getAttribute("attr1");
    // check testXSLT.xml for the expected result
    assertTrue(value1.equals("42"));

    xpath = new DOMXPath("/BLUB/root/element2");
View Full Code Here

    // check testXSLT.xml for the expected result
    assertTrue(value1.equals("42"));

    xpath = new DOMXPath("/BLUB/root/element2");
    Element element2
        = (Element)xpath.selectSingleNode(returnResult);
    String value2 = element2.getAttribute("attr2");
    // check testXSLT.xml for the expected result
    assertTrue(value2.equals("66"));

      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.