protected void loadDOMDocument(URL fileURL) throws IOException, DOMLoaderException { InputStream is = testResolve(fileURL); DOMLoader domloader = new XercesLoader(); domloader.set_validating(false); domDoc = domloader.load(is); domDoc.setDocumentURI(fileURL.toString()); }
protected void loadDOMDocument(URL fileURL, URL schemaURL) throws IOException, DOMLoaderException, SAXException { InputStream is = testResolve(fileURL); InputStream schemaIs = testResolve(schemaURL); Schema jaxpSchema = getSchema(schemaIs); DOMLoader domloader = new XercesLoader(jaxpSchema); domloader.set_validating(false); domDoc = domloader.load(is); }
protected String resolveCharacterReferences(String xpath) { String docText = "<doc>" + xpath + "</doc>"; InputStream is; try { is = new ByteArrayInputStream(docText.getBytes("UTF-8")); DOMLoader domloader = new XercesLoader(); domloader.set_validating(false); Document temp = domloader.load(is); return temp.getDocumentElement().getFirstChild().getTextContent(); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } catch (DOMLoaderException e) { throw new RuntimeException(e); } }
protected String formatResultString(String resultFile) throws Exception { DOMLoader domloader = new XercesLoader(null); domloader.set_validating(false); InputStream is = bundle.getEntry(resultFile).openStream(); Document resultDoc = domloader.load(is); DOMImplementationLS domLS = (DOMImplementationLS) resultDoc.getImplementation().getFeature("LS", "3.0"); LSSerializer serializer = domLS.createLSSerializer(); String actual = serializer.writeToString(resultDoc.getDocumentElement()); actual = actual.replace("<?xml version=\"1.0\" encoding=\"UTF-16\"?>", ""); return actual.trim(); }