Package org.dom4j

Examples of org.dom4j.XPath


    SAXReader xmlReader =  this.getSAXReader();
   
    Document document = xmlReader.read(outputXml);
   
 
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/comment");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get no comment element", list.size(), 0);
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/property/column/comment");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get no comment element", 0, list.size());
   
   
  }
View Full Code Here


    SAXReader xmlReader =  this.getSAXReader();
   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and it has no arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/generator");
    List list = xpath.selectNodes(document);
    assertTrue("Expected to get one generator element", list.size() == 1);
    Attribute genAtt = ( (Element)list.get(0) ).attribute("class");
    assertEquals("Unexpected generator class name", "assigned", genAtt.getStringValue() );

    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/generator/param");
    list = xpath.selectNodes(document);
    assertTrue("Expected to get no generator param elements", list.size() == 0);
   
  }
View Full Code Here

    SAXReader xmlReader =  this.getSAXReader();
   
    Document document = xmlReader.read(outputXml);
   
    // Validate the Generator and that it does have arguments
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/generator");
    List list = xpath.selectNodes(document);
    assertTrue("Expected to get one generator element", list.size() == 1);
    Attribute genAtt = ( (Element)list.get(0) ).attribute("class");
    assertEquals("Unexpected generator class name", "org.hibernate.id.TableHiLoGenerator", genAtt.getStringValue() );

    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/generator/param");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get correct number of generator param elements", 2, list.size() );
    Element tableElement = (Element)list.get(0);
    Attribute paramTableAtt = tableElement.attribute("name");
    Element columnElement = (Element)list.get(1);
    Attribute paramColumnAtt = columnElement.attribute("name");
View Full Code Here

    SAXReader xmlReader =  this.getSAXReader();
   
    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

    SAXReader xmlReader =  this.getSAXReader();
   
    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);
   
    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

    SAXReader xmlReader =  this.getSAXReader();
   
    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

    SAXReader xmlReader =  this.getSAXReader();
   
    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

    SAXReader xmlReader =  this.getSAXReader();
   
    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

    SAXReader xmlReader =  this.getSAXReader();
   
    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

    SAXReader xmlReader =  this.getSAXReader();
   
    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

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.