Package eu.woolplatform.utils.xml
Class XMLObject
- java.lang.Object
-
- eu.woolplatform.utils.json.JsonObject
-
- eu.woolplatform.utils.xml.XMLObject
-
public abstract class XMLObject extends JsonObject
An XML object contains methods for XML serialisation. It extendsJsonObjectfor a meaningful toString().
-
-
Constructor Summary
Constructors Constructor Description XMLObject()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidreadXml(File file)Reads this object from XML code from the specified file.voidreadXml(InputStream input)Reads this object from XML code from the specified input stream.voidreadXml(Reader reader)Reads this object from XML code from the specified reader.voidreadXml(URL url)Reads this object from XML code from the specified URL.voidreadXml(Document doc)Reads this object from the specified XML document.abstract voidreadXml(Element elem)Reads this object from the specified XML element.abstract voidwriteXml(XMLWriter writer)Writes this object to the specified XML writer.voidwriteXml(File file)Writes this object as XML code to the specified file with UTF-8 encoding.voidwriteXml(OutputStream output)Writes this object as XML code to the specified output stream with UTF-8 encoding.voidwriteXml(Writer writer)Writes this object as XML code to the specified writer, which should use UTF-8 encoding.
-
-
-
Method Detail
-
writeXml
public void writeXml(File file) throws IOException
Writes this object as XML code to the specified file with UTF-8 encoding.- Parameters:
file- the file- Throws:
IOException- if a writing error occurs
-
writeXml
public void writeXml(OutputStream output) throws IOException
Writes this object as XML code to the specified output stream with UTF-8 encoding.- Parameters:
output- the output stream- Throws:
IOException- if a writing error occurs
-
writeXml
public void writeXml(Writer writer) throws IOException
Writes this object as XML code to the specified writer, which should use UTF-8 encoding.- Parameters:
writer- the writer- Throws:
IOException- if a writing error occurs
-
writeXml
public abstract void writeXml(XMLWriter writer) throws IOException
Writes this object to the specified XML writer.- Parameters:
writer- the XML writer- Throws:
IOException- if a writing error occurs
-
readXml
public void readXml(URL url) throws ParseException, IOException
Reads this object from XML code from the specified URL. It assumes UTF-8 encoding.- Parameters:
url- the URL- Throws:
ParseException- if the XML content is invalidIOException- if a reading error occurs
-
readXml
public void readXml(File file) throws ParseException, IOException
Reads this object from XML code from the specified file. It assumes UTF-8 encoding.- Parameters:
file- the file- Throws:
ParseException- if the XML content is invalidIOException- if a reading error occurs
-
readXml
public void readXml(InputStream input) throws ParseException, IOException
Reads this object from XML code from the specified input stream. It assumes UTF-8 encoding.- Parameters:
input- the input stream- Throws:
ParseException- if the XML content is invalidIOException- if a reading error occurs
-
readXml
public void readXml(Reader reader) throws ParseException, IOException
Reads this object from XML code from the specified reader.- Parameters:
reader- the reader- Throws:
ParseException- if the XML content is invalidIOException- if a reading error occurs
-
readXml
public void readXml(Document doc) throws ParseException
Reads this object from the specified XML document.- Parameters:
doc- the XML document- Throws:
ParseException- if the XML content is invalid
-
readXml
public abstract void readXml(Element elem) throws ParseException
Reads this object from the specified XML element.- Parameters:
elem- the XML element- Throws:
ParseException- if the XML content is invalid
-
-