|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.languagecomputer.api.query.QueryXML
public class QueryXML
Handles XML conversion for Query
s, QueryResult
s,
Keyword
s, and Answer
s. Designed to be capable of handling
different Query
versions much like the DocumentXML
. The
XML version number does not depend on the API version number.
Field Summary | |
---|---|
static String |
CURRENT_VERSION
|
Constructor Summary | |
---|---|
QueryXML()
Creates a new QueryXML that writes using the current Query XML
version. |
|
QueryXML(String version)
Creates a new QueryXML that writes using the given
version. |
Method Summary | |
---|---|
List<Answer> |
readAnswers(Reader reader)
Reads the XML into a new List of Answer s. |
Query |
readQuery(Reader reader)
Reads the XML into a new Query . |
List<QueryResult> |
readQueryResults(Reader reader,
DocumentXML xmlReader)
Reads the XML into a new List of QueryResult s. |
void |
writeAnswers(List<Answer> answers,
Writer writer)
Writes the given Answer s to XML in the given Writer . |
void |
writeQuery(Query query,
Writer writer)
Writes the given Query to XML in the given Writer . |
void |
writeQueryResults(List<QueryResult> queryResults,
DocumentXML xmlWriter,
Writer writer)
Writes the given QueryResult s to XML in the given
Writer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CURRENT_VERSION
Constructor Detail |
---|
public QueryXML()
QueryXML
that writes using the current Query XML
version. Is capable of reading all known versions.
CURRENT_VERSION
public QueryXML(String version)
QueryXML
that writes using the given
version. Is capable of reading all known versions.
version
- The version number to use for writing/reading. Using old
versions for writing is not guaranteed.Method Detail |
---|
public void writeQuery(Query query, Writer writer) throws IOException
Query
to XML in the given Writer
.
Does not close the Writer
.
query
- Query
to serialize to XML.writer
- Writer
to write the XML to.
IllegalStateException
- If the version number is unknown.
IOException
- If there is a problem writing to XML.public void writeQueryResults(List<QueryResult> queryResults, DocumentXML xmlWriter, Writer writer) throws IOException
QueryResult
s to XML in the given
Writer
. Does not close the Writer
.
queryResults
- QueryResult
s to serialize to XML.xmlWriter
- DocumentXML
to convert the Document
to
a specific XML version.writer
- Writer
to write the XML to.
IllegalStateException
- If the version number is unknown.
IOException
- If there is a problem writing to XML.public void writeAnswers(List<Answer> answers, Writer writer) throws IOException
Answer
s to XML in the given Writer
.
Does not close the Writer
.
answers
- Answer
s to serialize to XML.writer
- Writer
to write the XML to.
IllegalStateException
- If the version number is unknown.
IOException
- If there is a problem writing to XML.public Query readQuery(Reader reader) throws IOException
Query
.
reader
- Reader
to read the XML from.
Query
from the XML.
IllegalArgumentException
- If the Query
is an unknown version
or is un-readable.
IOException
- If there is a problem reading the XML.public List<QueryResult> readQueryResults(Reader reader, DocumentXML xmlReader) throws IOException
List
of QueryResult
s.
reader
- Reader
to read the XML from.
QueryResult
s from the XML.
IllegalArgumentException
- If the QueryResult
s are an unknown
version or is un-readable.
IOException
- If there is a problem reading the XML.public List<Answer> readAnswers(Reader reader) throws IOException
List
of Answer
s.
reader
- Reader
to read the XML from.
Answer
s from the XML.
IllegalArgumentException
- If the Answer
s are an unknown
version or is un-readable.
IOException
- If there is a problem reading the XML.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |