public final class XmlUtil extends Object
Modifier and Type | Method and Description |
---|---|
static org.dom4j.Element |
addAndGetElementMultiple(org.dom4j.Document doc,
String path)
Add an element given by the path relative to the document
|
static org.dom4j.Element |
addAndGetElementMultiple(org.dom4j.Element ref,
String path)
Add an element given by the path relative to the referent element
|
static org.dom4j.Element |
addAndSetElementMultiple(org.dom4j.Document doc,
String path,
String value)
Add an element given by the path relative to the document and set the
value
|
static org.dom4j.Element |
addAndSetElementMultiple(org.dom4j.Element ref,
String path,
String value)
Add an element given by the path relative to the referent element and set
the value
|
static org.dom4j.Element |
addOrGetElement(org.dom4j.Document doc,
String path)
Add or Get (if already existing) an element given by the path relative to
the document
|
static org.dom4j.Element |
addOrGetElement(org.dom4j.Element ref,
String path)
Add or Get (if already existing) an element given by the path relative to
the referent element
|
static org.dom4j.Element |
addOrSetElement(org.dom4j.Document doc,
String path,
String value)
Add or Get (if already existing) an element given by the path relative to
the document and set the value
|
static org.dom4j.Element |
addOrSetElement(org.dom4j.Element ref,
String path,
String value)
Add or Get (if already existing) an element given by the path relative to
the referent element and set the
value
|
static org.dom4j.Document |
createEmptyDocument() |
static org.dom4j.Document |
getDocument(File file) |
static org.dom4j.Document |
getDocument(String filename) |
static org.dom4j.Element |
getElement(org.dom4j.Document doc,
String path) |
static org.dom4j.Element |
getElement(org.dom4j.Element ref,
String path) |
static List<org.dom4j.Node> |
getElementMultiple(org.dom4j.Document doc,
String path) |
static List<org.dom4j.Node> |
getElementMultiple(org.dom4j.Element ref,
String path) |
static String |
getExtraTrimed(String string)
Remove extra space and tab, newline from beginning and end of String
|
static org.dom4j.Element |
getParentElement(org.dom4j.Document doc,
String path) |
static org.dom4j.Element |
getParentElement(org.dom4j.Element ref,
String path) |
static org.dom4j.Element |
getRootElement(org.dom4j.Document document) |
static XmlValue[] |
read(org.dom4j.Document doc,
XmlDecl[] decls)
Create the XmlValues from the XmlDevls and the Document
|
static XmlValue[] |
read(org.dom4j.Element ref,
XmlDecl[] decls)
Create the XmlValues from the XmlDevls and the reference Element
|
static org.dom4j.Document |
readDocument(String document)
Read the document from the string
|
static void |
saveDocument(File file,
org.dom4j.Document document)
Save the document into the file
|
static void |
saveDocument(String filename,
org.dom4j.Document document)
Save the document into the file
|
static void |
saveDocument(Writer outWriter,
org.dom4j.Document document)
Save the document into the Writer outWriter
|
static void |
saveElement(File file,
org.dom4j.Element element)
Save the branch from element into the file
|
static void |
saveElement(String filename,
org.dom4j.Element element)
Save the branch from element into the file
|
static void |
write(org.dom4j.Document doc,
XmlValue[] values)
Add all nodes from XmlValues into Document
|
static void |
write(org.dom4j.Element ref,
XmlValue[] values)
Add all nodes from XmlValues from the referenced Element
|
static String |
writeToString(org.dom4j.Document document) |
static String |
writeToString(org.dom4j.Element element) |
static void |
writeXML(String filename,
String encoding,
org.dom4j.Document document)
Write the given XML document to filename using the encoding
|
public static org.dom4j.Document getDocument(String filename) throws IOException, org.dom4j.DocumentException
filename
- IOException
org.dom4j.DocumentException
public static org.dom4j.Document getDocument(File file) throws IOException, org.dom4j.DocumentException
file
- IOException
org.dom4j.DocumentException
public static org.dom4j.Document readDocument(String document) throws org.dom4j.DocumentException
document
- as Stringorg.dom4j.DocumentException
public static String writeToString(org.dom4j.Document document)
document
- public static String writeToString(org.dom4j.Element element)
element
- public static org.dom4j.Document createEmptyDocument()
public static void saveDocument(String filename, org.dom4j.Document document) throws IOException
filename
- document
- IOException
public static void saveDocument(File file, org.dom4j.Document document) throws IOException
file
- document
- IOException
public static void saveDocument(Writer outWriter, org.dom4j.Document document) throws IOException
outWriter
- document
- IOException
public static void saveElement(String filename, org.dom4j.Element element) throws IOException
filename
- element
- IOException
public static void saveElement(File file, org.dom4j.Element element) throws IOException
file
- element
- IOException
public static org.dom4j.Element getRootElement(org.dom4j.Document document)
document
- public static org.dom4j.Element addOrSetElement(org.dom4j.Element ref, String path, String value)
ref
- path
- value
- public static org.dom4j.Element addOrGetElement(org.dom4j.Element ref, String path)
ref
- path
- public static org.dom4j.Element addAndSetElementMultiple(org.dom4j.Element ref, String path, String value)
ref
- path
- value
- public static org.dom4j.Element addAndGetElementMultiple(org.dom4j.Element ref, String path)
ref
- path
- public static org.dom4j.Element getParentElement(org.dom4j.Element ref, String path) throws org.dom4j.DocumentException
ref
- path
- org.dom4j.DocumentException
public static org.dom4j.Element getElement(org.dom4j.Element ref, String path) throws org.dom4j.DocumentException
ref
- path
- org.dom4j.DocumentException
public static List<org.dom4j.Node> getElementMultiple(org.dom4j.Element ref, String path) throws org.dom4j.DocumentException
ref
- path
- org.dom4j.DocumentException
public static org.dom4j.Element addOrSetElement(org.dom4j.Document doc, String path, String value)
doc
- path
- value
- public static org.dom4j.Element addOrGetElement(org.dom4j.Document doc, String path)
doc
- path
- public static org.dom4j.Element addAndSetElementMultiple(org.dom4j.Document doc, String path, String value)
doc
- path
- value
- public static org.dom4j.Element addAndGetElementMultiple(org.dom4j.Document doc, String path)
doc
- path
- public static org.dom4j.Element getParentElement(org.dom4j.Document doc, String path) throws org.dom4j.DocumentException
doc
- path
- org.dom4j.DocumentException
public static org.dom4j.Element getElement(org.dom4j.Document doc, String path) throws org.dom4j.DocumentException
doc
- path
- org.dom4j.DocumentException
public static List<org.dom4j.Node> getElementMultiple(org.dom4j.Document doc, String path) throws org.dom4j.DocumentException
doc
- path
- org.dom4j.DocumentException
public static String getExtraTrimed(String string)
string
- public static XmlValue[] read(org.dom4j.Document doc, XmlDecl[] decls)
doc
- decls
- public static XmlValue[] read(org.dom4j.Element ref, XmlDecl[] decls)
ref
- decls
- public static void write(org.dom4j.Document doc, XmlValue[] values)
doc
- values
- public static void write(org.dom4j.Element ref, XmlValue[] values)
ref
- values
- public static void writeXML(String filename, String encoding, org.dom4j.Document document) throws IOException
filename
- encoding
- if null, default encoding UTF-8 will be useddocument
- IOException
Copyright © 2009–2020 Waarp. All rights reserved.