xmlparser.java~7~

来自「Describes basic connections from java to」· JAVA~7~ 代码 · 共 43 行

JAVA~7~
43
字号
package com.jsc.utils;import org.xml.sax.*;import org.w3c.dom.*;import javax.xml.parsers.*;import java.util.*;public class XMLParser {    protected Document m_doc;    public XMLParser(Document doc) {        m_doc = doc;    }    public Node getByNodeName(Node node, String nodeName) {        NodeList childList = node.getChildNodes();        Node out = null;        for ( int i=0; i < childList.getLength(); i++ ) {            String _nodeName =  childList.item(i).getNodeName();            if ( _nodeName.equals(nodeName) ) {                out = childList.item(i);                break;            }        }        return out;    }    public Vector getByNodeName2(Node node, String nodeName) {        Vector v = new Vector();        NodeList childList = node.getChildNodes();        Node out = null;        for ( int i=0; i < childList.getLength(); i++ ) {            String _nodeName =  childList.item(i).getNodeName();            if ( _nodeName.equals(nodeName) ) {                out = childList.item(i);                v.add(out);            }        }        return v;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?