|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XMLizable
An interface to be implemented by UIMA classes that can be written to and parsed from XML.
Classes must implement this interface in order for the UIMA XMLParser
to generate them
from XML documents. XMLizble 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)
.
Method Summary | |
---|---|
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. |
Method Detail |
---|
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 written
IOException
- if an I/O failure occurs
SAXException
void 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 occurs
SAXException
void 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.
IOException
- if an I/O failure occurs
SAXException
void 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.
IOException
- if an I/O failure occurs
SAXException
void 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 settings
InvalidXMLException
- if the input XML element does not specify a valid object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |