Class XmlTools
- java.lang.Object
-
- de.unirostock.sems.xmlutils.tools.XmlTools
-
public class XmlTools extends Object
XML toolkit.- Author:
- Martin Scharm
-
-
Constructor Summary
Constructors Constructor Description XmlTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.jdom2.input.SAXBuildergetBuilder()static StringprettyPrintDocument(org.jdom2.Document doc)Pretty prints a document.static StringprintDocument(org.jdom2.Document doc)Prints a document.static org.jdom2.DocumentreadDocument(File file)Reads an XML document from File.static org.jdom2.DocumentreadDocument(InputStream is)Reads an XML document from File.static org.jdom2.DocumentreadDocument(String doc)Read an XML document from String.static org.jdom2.DocumentreadDocument(URL url)Read an XML document from web.
-
-
-
Method Detail
-
getBuilder
public static org.jdom2.input.SAXBuilder getBuilder()
- Returns:
- the sax builder
-
readDocument
public static org.jdom2.Document readDocument(File file) throws IOException, org.jdom2.JDOMException
Reads an XML document from File.- Parameters:
file- the document to read- Returns:
- the document
- Throws:
IOException- Signals that an I/O exception has occurred.org.jdom2.JDOMException- the jDOM exception
-
readDocument
public static org.jdom2.Document readDocument(URL url) throws IOException, URISyntaxException, org.jdom2.JDOMException
Read an XML document from web.- Parameters:
url- the url to the document- Returns:
- the document
- Throws:
IOException- Signals that an I/O exception has occurred.URISyntaxException- the uRI syntax exceptionorg.jdom2.JDOMException- the jDOM exception
-
readDocument
public static org.jdom2.Document readDocument(InputStream is) throws IOException, org.jdom2.JDOMException
Reads an XML document from File.- Parameters:
is- the stream containing the document- Returns:
- the document
- Throws:
IOException- Signals that an I/O exception has occurred.org.jdom2.JDOMException- the jDOM exception
-
readDocument
public static org.jdom2.Document readDocument(String doc) throws IOException, org.jdom2.JDOMException
Read an XML document from String.- Parameters:
doc- the string containing the XML document- Returns:
- the document
- Throws:
IOException- Signals that an I/O exception has occurred.org.jdom2.JDOMException- the jDOM exception
-
printDocument
public static String printDocument(org.jdom2.Document doc)
Prints a document.- Parameters:
doc- the document- Returns:
- the string
-
prettyPrintDocument
public static String prettyPrintDocument(org.jdom2.Document doc)
Pretty prints a document.- Parameters:
doc- the document- Returns:
- the output stream
-
-