Package org.dom4j

Examples of org.dom4j.Element.selectSingleNode()


        String xpath = "/xs:schema/xs:element[@name='person']";
        assertNotNull("element is null", document.selectSingleNode(xpath));

        Element root = document.getRootElement();

        assertNotNull("element is null", root.selectSingleNode(xpath));
    }
}

/*
* Redistribution and use of this software and associated documentation
View Full Code Here


  @Override
  @SuppressWarnings("unchecked")
  public List<Application> parseApplication() {
    List<Application> appList = new LinkedList<Application>();
    Element aroot = getRoot();
    Node root = aroot.selectSingleNode("//applications");
    List<Element> elementList = root.selectNodes("application");
    for (Element e : elementList) {
      String user = e.attributeValue("user");
      String password = e.attributeValue("password");
      Application app = new Application();
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public List<ServiceVersion> parseSecurity() {
    List<ServiceVersion> versionList = new LinkedList<ServiceVersion>();
    Element aroot = getRoot();
    Node root = aroot.selectSingleNode("//security-settings");
    if(root == null){
      return null;
    }
    List<Element> sList = root.selectNodes("security-setting");
    for (Element element : sList) {
View Full Code Here

    SAXReader reader = new SAXReader();
    Document document = reader.read(new StringReader(output));
    Element rootElement = document.getRootElement();

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'VALUE_2']");
    assertEquals("TestEnum: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("TestEnum: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }
View Full Code Here

    Document document = reader.read(new StringReader(output));
    Element rootElement = document.getRootElement();

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'VALUE_2']");
    assertEquals("TestEnum: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("TestEnum: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }
View Full Code Here

    Element rootElement = document.getRootElement();

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'VALUE_2']");
    assertEquals("TestEnum: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("TestEnum: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }

  public void testWithoutItemsEnumBindTargetWithExplicitLabelsAndValues() throws Exception {
View Full Code Here

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'VALUE_2']");
    assertEquals("TestEnum: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("TestEnum: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }

  public void testWithoutItemsEnumBindTargetWithExplicitLabelsAndValues() throws Exception {
    BeanWithEnum testBean = new BeanWithEnum();
View Full Code Here

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'VALUE_2']");
    assertEquals("TestEnum: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("TestEnum: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }

  public void testWithoutItemsEnumBindTargetWithExplicitLabelsAndValues() throws Exception {
    BeanWithEnum testBean = new BeanWithEnum();
    testBean.setTestEnum(TestEnum.VALUE_2);
View Full Code Here

    SAXReader reader = new SAXReader();
    Document document = reader.read(new StringReader(output));
    Element rootElement = document.getRootElement();

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'Value: VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'Value: VALUE_2']");
    assertEquals("Label: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("Label: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }
View Full Code Here

    Document document = reader.read(new StringReader(output));
    Element rootElement = document.getRootElement();

    assertEquals(2, rootElement.elements().size());
    Node value1 = rootElement.selectSingleNode("//input[@value = 'Value: VALUE_1']");
    Node value2 = rootElement.selectSingleNode("//input[@value = 'Value: VALUE_2']");
    assertEquals("Label: VALUE_1", rootElement.selectSingleNode("//label[@for = '" + value1.valueOf("@id") + "']").getText());
    assertEquals("Label: VALUE_2", rootElement.selectSingleNode("//label[@for = '" + value2.valueOf("@id") + "']").getText());
    assertEquals(value2, rootElement.selectSingleNode("//input[@checked]"));
  }
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.