zoukankan      html  css  js  c++  java
  • DOM4J 递归解析xml文件

    1 public void read(Element e) {
    2 if (e.nodeCount() > 0) {
    3 Iterator<?> it = e.elementIterator();
    4 while (it.hasNext()) {
    5 Element ele = (Element) it.next();
    6 read(ele);
    7 System.out.println("Element :" + ele.getName() + " Path "
    8 + ele.getUniquePath());
    9
    10 if (ele.attributeCount() > 0) {
    11 Iterator<?> ait = ele.attributeIterator();
    12 System.out.print(" Data : [ ");
    13 while (ait.hasNext()) {
    14 Attribute attribute = (Attribute) ait.next();
    15 System.out.print(attribute.getName() + " : "
    16 + attribute.getData() + " ");
    17 }
    18 System.out.print(" ]");
    19 System.out.println();
    20 }
    21 }
    22 }
    23
    24 }


  • 相关阅读:
    Python-append()/extend()
    HTML标签
    字符实体
    css选择器
    边框属性
    背景属性
    文本属性
    字体属性
    给标签起名字
    JS数据类型
  • 原文地址:https://www.cnblogs.com/lfzark/p/2090082.html
Copyright © 2011-2022 走看看