Code example for DocumentBuilder

Methods: parse, setEntityResolver

0
		throws IOException 
	{ 
		try { 
			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
			DocumentBuilder builder = factory.newDocumentBuilder();
			builder.setEntityResolver(new NoResolver());
			return builder.parse((new InputSource(new StringReader(data))));
		} catch (Exception ex) {
			throw new IOException(ex);
		} 
	} 
 
 
	/** 
	 * Returns a XMLStreamReader for the XML document at the given path. 
	 */ 
	public static XMLStreamReader createXMLStreamReader(String file)
		throws IOException, XMLStreamException 
	{ 
		return createXMLStreamReader(new FileInputStream(file));
	}