protected Document parse(File artifact) throws Exception { return XmlUtils.parse(artifact, new ErrorHandler() { public void warning(SAXParseException exception) throws SAXException { } public void error(SAXParseException exception) throws SAXException { } public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); }
public static void transform(Source xmlSource, Result outputTarget) throws TransformerException { Transformer t = transformer(); try { t.transform(xmlSource, outputTarget); } finally { t.reset(); } }
public static Set<String> analyze(Source source) throws Exception { Set<String> refers = new TreeSet<>(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); Result r = new StreamResult(bout); XmlUtils.transform(new StreamSource(SpringTransformer.class.getResourceAsStream("extract.xsl")), source, r); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); bout.close(); BufferedReader br = new BufferedReader(new InputStreamReader(bin)); String line = br.readLine(); while (line != null) { line = line.trim(); if (line.length() > 0) { String parts[] = line.split("\\s*,\\s*"); for (String part : parts) { int n = part.lastIndexOf('.'); if (n > 0) { String pkg = part.substring(0, n); if (!pkg.startsWith("java.")) { refers.add(part.substring(0, n)); } } } } line = br.readLine(); } br.close(); return refers; }
public static Document parse(String uri) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); try { return db.parse(uri); } finally { db.reset(); } }
private static Features unmarshalNoValidate(String uri, InputStream stream) { try { Unmarshaller unmarshaller = FEATURES_CONTEXT.createUnmarshaller(); NoSourceAndNamespaceFilter xmlFilter = new NoSourceAndNamespaceFilter(XmlUtils.xmlReader()); xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler()); InputSource is = new InputSource(uri); if (stream != null) { is.setByteStream(stream); } SAXSource source = new SAXSource(xmlFilter, is); Features features = (Features) unmarshaller.unmarshal(source); features.setNamespace(xmlFilter.getNamespace()); return features; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Unable to load " + uri, e); } }
public static Set<String> analyze(Source source) throws Exception { Set<String> refers = new TreeSet<String>(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); Result r = new StreamResult(bout); XmlUtils.transform(new StreamSource(BlueprintTransformer.class.getResourceAsStream("extract.xsl")), source, r); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); bout.close(); BufferedReader br = new BufferedReader(new InputStreamReader(bin)); String line = br.readLine(); while (line != null) { line = line.trim(); if (line.length() > 0) { String parts[] = line.split("\\s*,\\s*"); for (String part : parts) { int n = part.lastIndexOf('.'); if (n > 0) { String pkg = part.substring(0, n); if (!pkg.startsWith("java.")) { refers.add(pkg); } } } } line = br.readLine(); } br.close(); return refers; }
public static Document parse(File f, ErrorHandler errorHandler) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); db.setErrorHandler(errorHandler); try { return db.parse(f); } finally { db.reset(); } }
protected Document parse(File artifact) throws Exception { return XmlUtils.parse(artifact, new ErrorHandler() { public void warning(SAXParseException exception) throws SAXException { } public void error(SAXParseException exception) throws SAXException { } public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); }
public static Set<String> analyze(Source source) throws Exception { Set<String> refers = new TreeSet<String>(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); Result r = new StreamResult(bout); XmlUtils.transform(new StreamSource(BlueprintTransformer.class.getResourceAsStream("extract.xsl")), source, r); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); bout.close(); BufferedReader br = new BufferedReader(new InputStreamReader(bin)); String line = br.readLine(); while (line != null) { line = line.trim(); if (line.length() > 0) { String parts[] = line.split("\\s*,\\s*"); for (String part : parts) { int n = part.lastIndexOf('.'); if (n > 0) { String pkg = part.substring(0, n); if (!pkg.startsWith("java.")) { refers.add(pkg); } } } } line = br.readLine(); } br.close(); return refers; }
public static Document parse(InputStream stream) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); try { return db.parse(stream); } finally { db.reset(); } }
public static void transform(Source xsltSource, Source xmlSource, Result outputTarget) throws TransformerException { Transformer t = transformer(xsltSource); try { t.transform(xmlSource, outputTarget); } finally { t.reset(); } }
protected static Document parse(URL url) throws Exception { try (InputStream is = url.openStream()) { return XmlUtils.parse(is); } }
out.putNextEntry(e); XmlUtils.transform(new DOMSource(doc), new StreamResult(out)); out.closeEntry(); out.close();
public static Document parse(File f) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); try { return db.parse(f); } finally { db.reset(); } }
protected static Document parse(URL url) throws Exception { try (InputStream is = url.openStream()) { return XmlUtils.parse(is); } }
out.putNextEntry(e); XmlUtils.transform(new DOMSource(doc), new StreamResult(out)); out.closeEntry(); out.close();
protected static Document parse(URL url) throws Exception { try (InputStream is = url.openStream()) { return XmlUtils.parse(is); } }
out.putNextEntry(e); XmlUtils.transform(new DOMSource(doc), new StreamResult(out)); out.closeEntry(); out.close();