public class DOMBuilder extends Object
| Constructor and Description |
|---|
DOMBuilder() |
| Modifier and Type | Method and Description |
|---|---|
static Document |
buildDoc(File file)
Build W3C DOM representation of XML from
File. |
static Document |
buildDoc(InputSource is)
Build W3C DOM representation of XML from
. |
static Document |
buildDoc(InputStream is)
Build W3C DOM representation of XML from
. |
static Document |
buildDoc(String doc)
Build W3C DOM representation of XML file specified by filesystem path.
|
static Document |
buildDocFromFilepath(String filepath)
Build W3C DOM representation of XML file specified by filesystem path.
|
static Node |
cloneNodeToNewDoc(Node nodeToClone,
boolean deep)
Create new W3C DOM document with only child node created as the clone of
the given node (detached from the DOM of the source node) and return the
cloned node attached to the new document.
|
static Document |
createEmptyDoc()
Create new empty document.
|
static Document |
createNewDocWithNodeClone(Node nodeToClone,
boolean deep)
Create new W3C DOM document with only child node created as the clone of
the given node (detached from the DOM of the source node).
|
static DocumentBuilder |
getDocumentBuilder()
Get W3C DOM document builder with common configuration set: most
importantly build is set to be namesapace aware.
|
public static Document buildDocFromFilepath(String filepath) throws ParserConfigurationException, SAXException, IOException
filepath - Path of the file in filesystem to build DOM from.ParserConfigurationException - If a DocumentBuilder cannot be
created which satisfies the configuration requested.SAXException - If any parse errors occur.IOException - If any IO errors occur.public static Document buildDoc(String doc) throws ParserConfigurationException, SAXException, IOException
doc - String with XML document to build DOM from.ParserConfigurationException - If a DocumentBuilder cannot be
created which satisfies the configuration requested.SAXException - If any parse errors occur.IOException - If any IO errors occur.public static Document buildDoc(File file) throws ParserConfigurationException, SAXException, IOException
File.file - XML File to build DOM from.ParserConfigurationException - If a DocumentBuilder cannot be
created which satisfies the configuration requested.SAXException - If any parse errors occur.IOException - If any IO errors occur.public static Document buildDoc(InputSource is) throws ParserConfigurationException, SAXException, IOException
InputSource.is - Input source to build DOM from.ParserConfigurationException - If a DocumentBuilder cannot be
created which satisfies the configuration requested.SAXException - If any parse errors occur.IOException - If any IO errors occur.public static Document buildDoc(InputStream is) throws ParserConfigurationException, SAXException, IOException
InputStream.is - Input stream to build DOM from.ParserConfigurationException - If a DocumentBuilder cannot be
created which satisfies the configuration requested.SAXException - If any parse errors occur.IOException - If any IO errors occur.public static Document createEmptyDoc()
null
otherwise.public static Document createNewDocWithNodeClone(Node nodeToClone, boolean deep)
nodeToClone - Node to clone as the only child node of the new
document.deep - If true, recursively clone the subtree under the given node;
if false, clone only the node itself (and its attributes, if it is an
Element).public static Node cloneNodeToNewDoc(Node nodeToClone, boolean deep)
nodeToClone - Node to clone as the only child node of the new
document.deep - If true, recursively clone the subtree under the given node;
if false, clone only the node itself (and its attributes, if it is an
Element).public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
ParserConfigurationExceptionCopyright © 2016. All rights reserved.