Code example for DocumentBuilder

Methods: parse, setEntityResolver

0
 
			DocumentBuilderFactory builderFactory = DocumentBuilderFactory
					.newInstance();
			builderFactory.setValidating(false);
			DocumentBuilder builder = builderFactory.newDocumentBuilder();
			builder.setEntityResolver(NoOpEntityResolver.getInstance());
			// TODO:Encoding 
 
			return builder.parse(in);
		} 
 
		private InputStream getGadget(HttpServletRequest request) throws Exception {
			InputStream is = null;
			ProxyRequest proxyRequest = null;
			try { 
				proxyRequest = new ProxyRequest(url, "XML");
				proxyRequest.setLocales(request.getLocales());
				proxyRequest.setPortalUid((String) request.getSession()
						.getAttribute("Uid")); 
				proxyRequest.setTimeout((timeout > 0) ? timeout
						: ProxyServlet.DEFAULT_TIMEOUT);