Java Utililty Methods XML Document Create

List of utility methods to do XML Document Create

Description

The list of methods to do XML Document Create are organized into topic(s).

Method

DocumentgetDocument(InputStream xmlInputStream)
get Document
Document document = null;
try {
    DocumentBuilder builder = docFactory.newDocumentBuilder();
    document = builder.parse(xmlInputStream);
} catch (SAXException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
...
DocumentgetDocument(Node node)
get Document
return node.getOwnerDocument();
DocumentgetDocument(Node parent)
get Document
return (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument();
DocumentgetDocument(Resource resource)
get Document
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(resource.getFile());
return document;
DocumentgetDocument(String docPath)
Gets XML Document for a given document path
return _docBuilder.parse(docPath);
DocumentgetDocument(String fileName)
This method returns the Document object for xml file.
File file = new File(fileName);
DocumentBuilder documentBuilder = getDocumentBuilder();
return documentBuilder.parse(file);
DocumentgetDocument(String filePath)
get Document
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(filePath));
DocumentgetDocument(String payload)
get Document
if (payload == null || payload.length() < 1)
    return null;
StringReader sr = new StringReader(payload);
InputSource source = new InputSource(sr);
return getDocument(source, null);
DocumentgetDocument(String xml)
get Document
return getDocumentBuilder().parse(xml);
DocumentgetDocument(String xml)
get Document
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
return factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml)));