Package org.jaxen.dom4j

Examples of org.jaxen.dom4j.Dom4jXPath.selectSingleNode()


            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

      String xPath = MessageFormat.format( BEAN_ID_XPATH, objectId );
      HashMap<String, String> map = new HashMap<String, String>();
      map.put( "default", DEFAULT_NAMESPACE ); //$NON-NLS-1$
      Dom4jXPath xpath = new Dom4jXPath( xPath );
      xpath.setNamespaceContext( new SimpleNamespaceContext( map ) );
      Element element = (Element) xpath.selectSingleNode( document );
      return element;
    } catch ( JaxenException jex ) {
      return null;
    }
  }
View Full Code Here

      String xPath = MessageFormat.format( BEAN_ID_XPATH, objectId );
      HashMap<String, String> map = new HashMap<String, String>();
      map.put( "default", DEFAULT_NAMESPACE ); //$NON-NLS-1$
      Dom4jXPath xpath = new Dom4jXPath( xPath );
      xpath.setNamespaceContext( new SimpleNamespaceContext( map ) );
      Element element = (Element) xpath.selectSingleNode( document );
      return element.attributeValue( CLASS_ATTRIBUTE );
    } catch ( JaxenException jex ) {
      return null;
    }
  }
View Full Code Here

    try {
      HashMap<String, String> map = new HashMap<String, String>();
      map.put( "default", DEFAULT_NAMESPACE ); //$NON-NLS-1$
      Dom4jXPath xpath = new Dom4jXPath( BEAN_ID_XPATH );
      xpath.setNamespaceContext( new SimpleNamespaceContext( map ) );
      Element element = (Element) xpath.selectSingleNode( document );
      return element.attributeValue( SCOPE_ATTRIBUTE );
    } catch ( JaxenException jex ) {
      return null;
    }
View Full Code Here

           
            long start = System.currentTimeMillis();
           
            int count = 0;
            for (int i = 0; i < 1000; i++) {
                Element speaker = (Element) xpath.selectSingleNode(doc);
                count += (speaker == null ? 0 : 1);
            }
           
            long end = System.currentTimeMillis();
            System.out.println((end - start));
View Full Code Here

    }
   
    public void testNullPointerException() throws JaxenException {
        Document doc = DocumentHelper.createDocument();
        XPath xpath = new Dom4jXPath("/foo");
        xpath.selectSingleNode(doc);
    }   
   
   
}
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.