Interface XMLizable

    • Method Detail

      • toXML

        void toXML​(Writer aWriter)
            throws SAXException,
                   IOException
        Writes this object's XML representation as a string. Note that if you want to write the XML to a file or to a byte stream, it is highly recommended that you use toXML(OutputStream) instead, as it ensures that output is written in UTF-8 encoding, which is the default encoding that should be used for XML files.

        The XML String that is produced will have a header <?xml version="1.0" encoding="UTF-8"?>. Therefore you should not write this string out in any encoding other than UTF-8 (for example do not use the default platform encoding), or you will produce output that will not be able to be parsed.

        Parameters:
        aWriter - a Writer to which the XML string will be written
        Throws:
        IOException - if an I/O failure occurs
        SAXException - passthru
      • toXML

        void toXML​(OutputStream aOutputStream)
            throws SAXException,
                   IOException
        Writes this object's XML representation as a string in UTF-8 encoding.
        Parameters:
        aOutputStream - an OutputStream to which the XML string will be written, in UTF-8 encoding.
        Throws:
        IOException - if an I/O failure occurs
        SAXException - pass thru
      • toXML

        void toXML​(ContentHandler aContentHandler)
            throws SAXException
        Writes this object's XML representation by making calls on a SAX ContentHandler. This method just calls toXML(aContentHandler,false), so subclasses should override that version of this method, not this one.
        Parameters:
        aContentHandler - the content handler to which this object will write events that describe its XML representation.
        Throws:
        SAXException - pass thru
      • toXML

        void toXML​(ContentHandler aContentHandler,
                   boolean aWriteDefaultNamespaceAttribute)
            throws SAXException
        Writes this object's XML representation by making calls on a SAX ContentHandler.
        Parameters:
        aContentHandler - the content handler to which this object will write events that describe its XML representation.
        aWriteDefaultNamespaceAttribute - whether the namespace of this element should be written as the default namespace. This should be done only for the root element, and it defaults to false.
        Throws:
        SAXException - pass thru
      • buildFromXMLElement

        void buildFromXMLElement​(Element aElement,
                                 XMLParser aParser)
                          throws InvalidXMLException
        Initializes this object from its XML DOM representation. This method is typically called from the XMLParser.
        Parameters:
        aElement - the XML element that represents this object.
        aParser - a reference to the UIMA XMLParser. The XMLParser.buildObject(Element) method can be used to construct sub-objects.
        Throws:
        InvalidXMLException - if the input XML element does not specify a valid object