Package org.dom4j

Examples of org.dom4j.Document.selectNodes()


    for(Element node : collectionList) {
      System.out.println(node.elementText("analyzer"));
      System.out.println(node.elementText("indexingDirectory"));
     
      @SuppressWarnings("unchecked")
      List<Element> fieldsList = document.selectNodes("//field");
      for(Element e : fieldsList) {
        System.out.println(e.attributeValue("name"));
        System.out.println(e.attributeValue("store"));
        System.out.println(e.attributeValue("index"));
        System.out.println(e.attributeValue("type"));
View Full Code Here


        System.out.println(e.attributeValue("must"));
        System.out.println(e.attributeValue("boost"));
      }
     
      @SuppressWarnings("unchecked")
      List<Element> defaultSearchFields = document.selectNodes("//defaultSearchField");
      for(Element e : defaultSearchFields) {
        System.out.println(e.attributeValue("name"));
      }
     
      @SuppressWarnings("unchecked")
View Full Code Here

      for(Element e : defaultSearchFields) {
        System.out.println(e.attributeValue("name"));
      }
     
      @SuppressWarnings("unchecked")
      List<Element> sortFields = document.selectNodes("//sortField");
      for(Element e : sortFields) {
        System.out.println(e.attributeValue("source"));
        System.out.println(e.attributeValue("dest"));
      }
    }
View Full Code Here

       try{
           SAXReader saxReader = new SAXReader();  
           Document document = saxReader.read(new File(filename));
           /** �޸�����֮һ: ���book�ڵ���show����������Ϊyes,���޸ij�no */
           /** ����xpath���Ҷ��� */
           List list = document.selectNodes("/books/book/@show" );  
           Iterator iter = list.iterator();
           while(iter.hasNext()){
               Attribute attribute = (Attribute)iter.next();
               if(attribute.getValue().equals("yes")){
                   attribute.setValue("no");
View Full Code Here

           }        
           /**
            * �޸�����֮��: ��owner�����ݸ�ΪTshinghua
            * ����owner�ڵ��м���date�ڵ�,date�ڵ������Ϊ2004-09-11,��Ϊdate�ڵ����һ������type
            */
           list = document.selectNodes("/books/owner" );
           iter = list.iterator();
           if(iter.hasNext()){
               Element ownerElement = (Element)iter.next();
               ownerElement.setText("Tshinghua");
               Element dateElement = ownerElement.addElement("date");
View Full Code Here

               dateElement.setText("2004-09-11");
               dateElement.addAttribute("type","Gregorian calendar");
           }
         
           /** �޸�����֮��: ��title����ΪDom4j Tutorials,��ɾ���ýڵ� */
           list = document.selectNodes("/books/book");
           iter = list.iterator();
           while(iter.hasNext()){
               Element bookElement = (Element)iter.next();
               Iterator iterator = bookElement.elementIterator("title");
               while(iterator.hasNext()){
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private static List<Pattern> getPatterns(final String xpath) {
    final Document config = Log4TestingConfiguration.getConfig();
    final List<Node> expressions = config.selectNodes(xpath);
    final ArrayList<Pattern> patterns = new ArrayList<Pattern>(expressions
        .size());
    for (final Node expression : expressions) {
      final Pattern pattern = Pattern.compile(expression.getText());
      patterns.add(pattern);
View Full Code Here

  @SuppressWarnings("unchecked")
  public List<Writer<T>> getWriters() {
    final Document config = Log4TestingConfiguration.getConfig();
    final String xpath = getXPathOfWriterClasses();
    final List<Node> writerClasses = config.selectNodes(xpath);
    return getWriters(writerClasses);
  }

}
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private String replace(String output) {
    final Document conf = Log4TestingConfiguration.getConfig();
    final List<Node> replaceNodes = conf.selectNodes(XPATH_REPLACE);
    for (final Node replaceNode : replaceNodes) {
      final String regex = replaceNode.selectSingleNode(
          XPATH_REPLACE_REGEX).getStringValue();
      final String replacement = replaceNode.selectSingleNode(
          XPATH_REPLACE_REPLACEMENT).getStringValue();
View Full Code Here

  public Collection<TaskDto> getAllTasks() throws Exception {
    try {
      final List<TaskDto> results = new ArrayList<TaskDto>();
      final TreeMap<String, String> params = new TreeMap<String, String>();
      final Document response = parseXML(getRtmMethodUri("rtm.tasks.getList", params));
      final List<Node> taskListList = response.selectNodes("/rsp/tasks/list");
      for (final Node listNode : taskListList) {
        final Node listIdNode = listNode.selectSingleNode("@id");
        final List<Node> taskSeriesNodesList = listNode.selectNodes("taskseries");
        for (final Node taskSeriesNode : taskSeriesNodesList) {
          final Node timeSeriesIdNode = taskSeriesNode.selectSingleNode("@id");
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.