Code example for DocumentBuilder

Methods: parse, setEntityResolver

0
	} 
	 
	private Document gadget2dom( InputStream responseBody )
			throws ParserConfigurationException, SAXException, IOException { 
		DocumentBuilder builder = factory.newDocumentBuilder();
		builder.setEntityResolver(NoOpEntityResolver.getInstance());
		Document doc = builder.parse(responseBody);
		return doc;
	} 
 
	public static byte[] gadget2html( String baseUrl,Document doc,
			Map<String,String> urlParameters,I18NConverter i18n,Locale locale) throws Exception {
		XPathFactory xpathFactory = XPathFactory.newInstance();
		XPath xpath = xpathFactory.newXPath();
		Boolean specCompair = compareVersion(getModuleVersion(doc));
		String quirks = getQuirks(doc);
 
		VelocityContext context = new VelocityContext();
		 
		//quirks mode 
		context.put("doctype", getDoctype(specCompair, quirks));