Code example for DocumentBuilderFactory

Methods: newDocumentBuilder

0
	public XMLElement parse(String name, InputStream in) throws SlickXMLException {
		try { 
			if (factory == null) {
				factory = DocumentBuilderFactory.newInstance();
			} 
			DocumentBuilder builder = factory.newDocumentBuilder();
			Document doc = builder.parse(in);
			 
			return new XMLElement(doc.getDocumentElement());
		} catch (Exception e) {
			throw new SlickXMLException("Failed to parse document: "+name, e);
		} 
	} 
}