⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlparser.java

📁 这是一个我找的基于java编写的web源码
💻 JAVA
字号:
package HTTP;

import org.w3c.dom.*;
import javax.xml.parsers.*;
import org.xml.sax.*;

import java.io.*;
import java.util.*;

/**http://www.codefans.net
 * A class for XML parsing.  Java's API leaves parsing much 
 * more complicated than it should be.  This is to map the complexity in the API to 
 * single line method calls.  
 */
public class XMLParser
{
    /**
     * Parses the specified XML file to generate a Document.
     * @param f must be a valid XML file.
     * @throws SAXException if the file is not valid XML.  
     * If you have trouble validating one, opening the file in Firefox can help you troubleshoot.
     */
    public static Document getDocumentFor(File f) throws 
        IOException, SAXException,ParserConfigurationException
    {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.parse(f);
        return doc;
    }

}

⌨️ 快捷键说明

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