XMLUtil.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:emr-nlp-server 作者:
public static List<String> getModelFnFromXMLList(String fn_xmlList)
        throws Exception {
    List<String> modelNameList = new ArrayList<>();

if (fn_xmlList != null && Util.fileExists(fn_xmlList)) {
    org.w3c.dom.Document dom = null;
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    dom = db.parse(fn_xmlList);
    Element modellistRoot = dom.getDocumentElement();
    NodeList attributeNodes = modellistRoot
            .getElementsByTagName("Attr");

    for (int n = 0; n < attributeNodes.getLength(); n++) {
        Element attributeNode = (Element) attributeNodes.item(n);
        modelNameList.add(attributeNode.getAttribute("fileName").trim());
    }
}

    return modelNameList;
  }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号