Package org.dom4j

Examples of org.dom4j.XPath.selectNodes()


   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/query");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get correct number of query elements", 2, list.size() );
   
    Attribute genAtt = ( (Element)list.get(0) ).attribute("name");
    assertEquals("Unexpected query name", "test_query_1", genAtt.getStringValue() );
    genAtt = ( (Element)list.get(0) ).attribute("flush-mode");
View Full Code Here


   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get correct number of query elements", 6, list.size() );

    xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_1\"]");
    list = xpath.selectNodes(document);
   
View Full Code Here

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get correct number of query elements", 6, list.size() );

    xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_1\"]");
    list = xpath.selectNodes(document);
   
    Element node = (Element)list.get(0);
    assertNotNull("Expected sql-query named 'test_sqlquery_1' not to be null", node);

    Attribute genAtt = node.attribute("flush-mode");
View Full Code Here

   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_2\"]");
    List list = xpath.selectNodes(document);
   
    Element node = (Element)list.get(0);
    assertNotNull("Expected sql-query named 'test_sqlquery_2' not to be null", node);

    Attribute genAtt = node.attribute("name");
View Full Code Here

   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_3\"]");
    List list = xpath.selectNodes(document);
   
    Element node = (Element)list.get(0);
    assertNotNull("Expected sql-query named 'test_sqlquery_3' not to be null", node);

    Attribute genAtt = node.attribute("name");
View Full Code Here

   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_4\"]");
    List list = xpath.selectNodes(document);
   
    Element node = (Element)list.get(0);
    assertNotNull("Expected sql-query named 'test_sqlquery_4' not to be null", node);

    Attribute genAtt = node.attribute("name");
View Full Code Here

   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_5\"]");
    List list = xpath.selectNodes(document);
   
    Element node = (Element)list.get(0);
    assertNotNull("Expected sql-query named 'test_sqlquery_5' not to be null", node);

    Attribute genAtt = node.attribute("name");
View Full Code Here

   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/sql-query[@name=\"test_sqlquery_6\"]");
    List list = xpath.selectNodes(document);
   
    Element node = (Element)list.get(0);
    assertNotNull("Expected sql-query named 'test_sqlquery_6' not to be null", node);

    Attribute genAtt = node.attribute("name");
View Full Code Here

   
    Document document;
    try {
      document = xmlReader.read(outputXml);
      XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/properties");
      List list = xpath.selectNodes(document);
      assertEquals("Expected to get one properties element", 1, list.size());
      Element node = (Element) list.get(0);
      assertEquals(node.attribute( "name" ).getText(),"emergencyContact");
     
      assertNotNull(findFirstString("name", new File(getOutputDir(), "properties/PPerson.java" )));
View Full Code Here

    SAXReader xmlReader =  getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/property");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one property element", 2, list.size());
    Element statusElement = (Element) list.get(0);
    Element nameElement = (Element) list.get(1);
    if(!statusElement.attribute( "name" ).getText().equals("status")) {
      Element temp = nameElement;
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.