Class XMLObject


  • public abstract class XMLObject
    extends JsonObject
    An XML object contains methods for XML serialisation. It extends JsonObject for a meaningful toString().
    • Constructor Detail

      • XMLObject

        public XMLObject()
    • 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 invalid
        IOException - 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 invalid
        IOException - 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 invalid
        IOException - 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