Java XML Parse File parseAIMLFile(File file)

Here you can find the source of parseAIMLFile(File file)

Description

parse AIML File

License

Apache License

Declaration

public static Node parseAIMLFile(File file) throws ParserConfigurationException, IOException, SAXException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import java.io.File;
import java.io.IOException;

public class Main {

    public static Node parseAIMLFile(File file) throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();
        Document document = dbBuilder.parse(file);
        document.getDocumentElement().normalize();
        return document.getDocumentElement();
    }/*from w  ww.  j a  v  a 2 s .co m*/
}

Related

  1. parse(String fileName)
  2. parse(String fileName)
  3. parse(String fileName)
  4. parse(String filename)
  5. parse(String xmlFile)
  6. parseData(String filename)
  7. parseDoc(File xmlFile)
  8. parseFile(Class context, String name)
  9. parseFile(File file)