Package org.dom4j

Examples of org.dom4j.XPath.selectNodes()


    Document document;
    try {
        document = xmlReader.read(outputXml);
        XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/joined-subclass/comment");
        List list = xpath.selectNodes(document);
        assertEquals("Expected to get one comment element", 1, list.size());
      } catch (DocumentException e) {
        fail("Can't parse file " + outputXml.getAbsolutePath());
      }
    }
View Full Code Here


    SAXReader xmlReader =  this.getSAXReader();

    Document document = xmlReader.read(outputXml);
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/discriminator");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one discriminator element", 1, list.size());
     
    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "type" ).getText(), "string");
View Full Code Here

 
  public void testOneToOne() throws DocumentException {
    Document document = getXMLDocument(getBaseForMappings() + "Person.hbm.xml");   
 
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/one-to-one");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one-to-one element", 1, list.size());
    Element node = (Element) list.get(0);
    assertEquals(node.attribute( "name" ).getText(),"address");
    assertEquals(node.attribute( "constrained" ).getText(),"false");
   
View Full Code Here

    assertEquals(node.attribute( "constrained" ).getText(),"false");
   
    document = getXMLDocument(getBaseForMappings() + "Address.hbm.xml");
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/one-to-one");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get one set element", 1, list.size());
    node = (Element) list.get(0);
    assertEquals(node.attribute( "name" ).getText(),"person");
    assertEquals(node.attribute( "constrained" ).getText(),"true");
    assertEquals(node.attribute( "access" ).getText(), "field");
View Full Code Here

    SAXReader xmlReader =  getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/list");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get two list element", 2, list.size());
    Element node = (Element) list.get(1); //second list
    assertEquals("fooComponents", node.attribute( "name" ).getText());
    assertEquals("true", node.attribute( "lazy" ).getText());
    assertEquals("all", node.attribute( "cascade" ).getText());
View Full Code Here

    SAXReader xmlReader =  getSAXReader();

    Document document = xmlReader.read(outputXml);

    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/array");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one array element", 1, list.size());
    Element node = (Element) list.get(0);
    assertEquals("proxyArray", node.attribute( "name" ).getText());
    assertEquals("org.hibernate.tool.hbm2x.hbm2hbmxml.GlarchProxy", node.attribute( "element-class" ).getText());
   
View Full Code Here

    SAXReader xmlReader =  this.getSAXReader();
   
    Document document = xmlReader.read(outputXml);   
 
    XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/meta");
    List list = xpath.selectNodes(document);
    assertEquals("Expected to get one meta element", 2, list.size());
    Node node = (Node) list.get(0);
    assertEquals(node.getText(),"Basic");
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/meta");
View Full Code Here

    assertEquals("Expected to get one meta element", 2, list.size());
    Node node = (Node) list.get(0);
    assertEquals(node.getText(),"Basic");
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/id/meta");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get one meta element", 1, list.size());
    node = (Node) list.get(0);
    assertEquals(node.getText(),"basicId")
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/property/meta");
View Full Code Here

    assertEquals("Expected to get one meta element", 1, list.size());
    node = (Node) list.get(0);
    assertEquals(node.getText(),"basicId")
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/property/meta");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get one meta element", 1, list.size());
    node = (Node) list.get(0);
    assertEquals(node.getText(),"description");
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/set/meta");
View Full Code Here

    assertEquals("Expected to get one meta element", 1, list.size());
    node = (Node) list.get(0);
    assertEquals(node.getText(),"description");
   
    xpath = DocumentHelper.createXPath("//hibernate-mapping/class/set/meta");
    list = xpath.selectNodes(document);
    assertEquals("Expected to get one meta element", 1, list.size());
    node = (Node) list.get(0);
    assertEquals(node.getText(),"anotherone");
   
  }
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.