public final class JkDomDocument
extends java.lang.Object
Document
offering a Parent-Chaining fluent interface.Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Document |
getW3cDocument()
Returns thd underlying w3c
Document . |
static JkDomDocument |
of(org.w3c.dom.Document w3cDocument)
Creates a
JkDomDocument wrapping the specified w3c document. |
static JkDomDocument |
of(java.lang.String rootName)
Creates a document with a root element of the specified name.
|
static JkDomDocument |
parse(java.io.InputStream inputStream)
Same as
parse(InputStream, DocumentBuilder) but using a default DocumentBuilder . |
static JkDomDocument |
parse(java.io.InputStream inputStream,
javax.xml.parsers.DocumentBuilder documentBuilder)
Creates a
JkDomDocument by parsing the content of specified input stream. |
static JkDomDocument |
parse(java.nio.file.Path file)
Creates a
JkDomDocument from the specified xml file. |
void |
print(java.io.OutputStream out)
Outputs xml in the specified stream.
|
void |
print(java.io.OutputStream out,
java.util.function.Consumer<org.w3c.dom.DOMConfiguration> domConfigurationConfigurer)
Same as
print(OutputStream) but caller can modify the default XML transformer using the
specified Consumer . |
JkDomElement |
root()
Returns the root element of this document.
|
void |
save(java.nio.file.Path file)
Saves this document in the specified file.
|
java.lang.String |
toXml()
Returns an XML String representation of this document.
|
public static JkDomDocument of(org.w3c.dom.Document w3cDocument)
JkDomDocument
wrapping the specified w3c document.public static JkDomDocument of(java.lang.String rootName)
public static JkDomDocument parse(java.io.InputStream inputStream, javax.xml.parsers.DocumentBuilder documentBuilder)
JkDomDocument
by parsing the content of specified input stream.
The stream content is parsed with the specified documentBuilder.public static JkDomDocument parse(java.io.InputStream inputStream)
parse(InputStream, DocumentBuilder)
but using a default DocumentBuilder
.public static JkDomDocument parse(java.nio.file.Path file)
JkDomDocument
from the specified xml file.public org.w3c.dom.Document getW3cDocument()
Document
.public JkDomElement root()
public void print(java.io.OutputStream out)
public void save(java.nio.file.Path file)
public void print(java.io.OutputStream out, java.util.function.Consumer<org.w3c.dom.DOMConfiguration> domConfigurationConfigurer)
print(OutputStream)
but caller can modify the default XML transformer using the
specified Consumer
.public java.lang.String toXml()