/** * Parse an InputStream of XML into Document. */ public final static Document parse(InputStream in) throws ParserConfigurationException, IOException, SAXException { return parse(new InputSource(in)); }
/** * Pretty-print a Document to File. */ public final static void print(Document document, File file) throws IOException { print(document, new FileWriter(file)); }
/** * Create blank Document, and insert root element with given name. */ public final static Document newDocument(String rootElementName) throws ParserConfigurationException { Document doc = newDocument(); doc.appendChild(doc.createElement(rootElementName)); return doc; }
String text = XMLUtils.getElementText(e); return XMLUtils.parse(text); } catch (Exception ex) { return null; // if XML cannot be parsed, ignore it. NodeList pElements = XMLUtils.xpathList(e, "properties/property"); props.put(pElement.getAttribute("key"), XMLUtils.getElementText(pElement));
/** * Perform XSL transformation. */ public final static void transform(Reader xml, Reader xsl, Writer result) throws TransformerException { transform(xml, xsl, result, null); }
int cacheSize = getCacheSize(); int iterations = 1;
/** * Perform XSL transformation. */ public final static void transform(Reader xml, Reader xsl, Writer result) throws TransformerException { transform(xml, xsl, result, null); }
int cacheSize = getCacheSize(); int iterations = 1;
/** * Parse a Reader of XML into Document. */ public final static Document parse(Reader in) throws ParserConfigurationException, IOException, SAXException { return parse(new InputSource(in)); }
/** * Pretty-print a Document to File. */ public final static void print(Document document, File file) throws IOException { print(document, new FileWriter(file)); }
/** * Create blank Document, and insert root element with given name. */ public final static Document newDocument(String rootElementName) throws ParserConfigurationException { Document doc = newDocument(); doc.appendChild(doc.createElement(rootElementName)); return doc; }
/** * Perform XSL transformation, with params. */ public final static void transform(Reader xml, Reader xsl, Writer result, Map parameters) throws TransformerException { transform(xml, xsl, result, parameters, xsl.toString()); }
/** * Parse a Reader of XML into Document. */ public final static Document parse(Reader in) throws ParserConfigurationException, IOException, SAXException { return parse(new InputSource(in)); }
/** * Pretty-print a Document to OutputStream. */ public final static void print(Document document, OutputStream out) throws IOException { print(document, new OutputStreamWriter(out)); }
/** * Perform XSL transformations using given Documents and return new Document. */ public final static Document transform(Document xml, Document xsl) throws ParserConfigurationException, TransformerException { try { Document result = newDocument(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer t = factory.newTransformer(new DOMSource(xsl)); t.transform(new DOMSource(xml), new DOMResult(result)); return result; } catch (TransformerConfigurationException tce) { throw new TransformerException(tce); } } }
/** * Perform XSL transformation, with params. */ public final static void transform(Reader xml, Reader xsl, Writer result, Map parameters) throws TransformerException { transform(xml, xsl, result, parameters, xsl.toString()); }
/** * Parse an InputStream of XML into Document. */ public final static Document parse(InputStream in) throws ParserConfigurationException, IOException, SAXException { return parse(new InputSource(in)); }
/** * Pretty-print a Document to OutputStream. */ public final static void print(Document document, OutputStream out) throws IOException { print(document, new OutputStreamWriter(out)); }