Here you can find the source of parseFile(String fileName)
public static Node parseFile(String fileName) throws Exception
//package com.java2s; //License from project: LGPL import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; public class Main { public static Node parseFile(String fileName) throws Exception { File file = new File(fileName); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); // from AIMLProcessor.evalTemplate and AIMLProcessor.validTemplate: // dbFactory.setIgnoringComments(true); // fix this Document doc = dBuilder.parse(file); doc.getDocumentElement().normalize(); Node root = doc.getDocumentElement(); return root; }/*from www. j a va 2s.c o m*/ }