Here you can find the source of parseXmlFile(File file, boolean validating)
public static Document parseXmlFile(File file, boolean validating) throws Exception
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Google, Inc./*from ww w . j av a 2 s. c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Google, Inc. - initial API and implementation *******************************************************************************/ import java.io.File; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { public static Document parseXmlFile(File file, boolean validating) throws Exception { // Create a builder factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validating); // Create the builder and parse the file Document doc = factory.newDocumentBuilder().parse(file); return doc; } }