public static Document loadXML(Reader is) {DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();DocumentBuilder db = null;try {db = dbf.newDocumentBuilder();}catch (Exception se) {throw new RuntimeException("Parser configuration error", se);}org.w3c.dom.Document doc = null;try {doc = db.parse(new InputSource(is));}catch (Exception se) {throw new RuntimeException("Error parsing file:" + se, se);}return doc;}
public static XmlDocument LoadXML(TextReader input){XmlDocument result = new XmlDocument();try{result.Load(input);}catch (Exception se){throw new Exception("Error parsing file:" + se, se);}return result;}