public interface XMLizable
XMLParser to generate them
from XML documents. XMLizable classes also must define a zero-argument constructor. When
constructing an object, the XMLParser will first create it using the zero-argument
constructor and then call buildFromXMLElement(Element,XMLParser).| Modifier and Type | Method and Description |
|---|---|
void |
buildFromXMLElement(Element aElement,
XMLParser aParser)
Initializes this object from its XML DOM representation.
|
void |
buildFromXMLElement(Element aElement,
XMLParser aParser,
XMLParser.ParsingOptions aOptions)
Initializes this object from its XML DOM representation.
|
void |
toXML(ContentHandler aContentHandler)
Writes this object's XML representation by making calls on a SAX
ContentHandler. |
void |
toXML(ContentHandler aContentHandler,
boolean aWriteDefaultNamespaceAttribute)
Writes this object's XML representation by making calls on a SAX
ContentHandler. |
void |
toXML(OutputStream aOutputStream)
Writes this object's XML representation as a string in UTF-8 encoding.
|
void |
toXML(Writer aWriter)
Writes this object's XML representation as a string.
|
void toXML(Writer aWriter) throws SAXException, IOException
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.
aWriter - a Writer to which the XML string will be writtenIOException - if an I/O failure occursSAXException - passthruvoid toXML(OutputStream aOutputStream) throws SAXException, IOException
aOutputStream - an OutputStream to which the XML string will be written, in UTF-8 encoding.IOException - if an I/O failure occursSAXException - pass thruvoid toXML(ContentHandler aContentHandler) throws SAXException
ContentHandler. This
method just calls toXML(aContentHandler,false), so subclasses should override
that version of this method, not this one.aContentHandler - the content handler to which this object will write events that describe its XML
representation.SAXException - pass thruvoid toXML(ContentHandler aContentHandler, boolean aWriteDefaultNamespaceAttribute) throws SAXException
ContentHandler.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.SAXException - pass thruvoid buildFromXMLElement(Element aElement, XMLParser aParser) throws InvalidXMLException
XMLParser.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.InvalidXMLException - if the input XML element does not specify a valid objectvoid buildFromXMLElement(Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions) throws InvalidXMLException
XMLParser.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.aOptions - option settingsInvalidXMLException - if the input XML element does not specify a valid objectCopyright © 2006–2017 The Apache Software Foundation. All rights reserved.