org.jdesktop.dataset.io.schema
Class XMLDataSetSchemaWriter

java.lang.Object
  extended by org.jdesktop.dataset.io.schema.XMLDataSetSchemaWriter
All Implemented Interfaces:
DataSetSchemaWriter

public class XMLDataSetSchemaWriter
extends java.lang.Object
implements DataSetSchemaWriter

Writes the schema for a DataSet out as an XML Schema.

Canonical use:

 Writer writer = new PrintWriter(System.out);
 XMLDataSetSchemaWriter xmlWriter = new XMLDataSetSchemaWriter(writer);
 xmlWriter.writeDataSet(ds);
 

You can also use the static DataSetUtility methods, like DataSetUtility.writeDataSetAsXml(OutputStream, DataSet) for a one-line operation.

Author:
Patrick Wright

Constructor Summary
XMLDataSetSchemaWriter(java.io.OutputStream os)
          Creates a new instance of XMLDataSetSchemaWriter for a given OutputStream.
XMLDataSetSchemaWriter(java.io.Writer writer)
          Creates a new instance of XMLDataSetSchemaWriter for a given Writer.
 
Method Summary
 void writeDataSet(DataSet ds)
          Writes the complete DataSet schema out as an XML Schema to the OutputStream or Writer this class was constructed with.
 void writeDataSet(DataSet ds, java.lang.String... tableNames)
          Writes the DataSet schema out as an XML Schema to the OutputStream or Writer this class was constructed with for the tables listed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDataSetSchemaWriter

public XMLDataSetSchemaWriter(java.io.OutputStream os)
Creates a new instance of XMLDataSetSchemaWriter for a given OutputStream.

Parameters:
os - The OutputStream to write to; must be open. Will not be closed by this class. The OutputStream will be wrapped in a PrintWriter so line separation will be environment-specific.

XMLDataSetSchemaWriter

public XMLDataSetSchemaWriter(java.io.Writer writer)
Creates a new instance of XMLDataSetSchemaWriter for a given Writer.

Parameters:
writer - The Writer to write to; must be open. Will not be closed by this class. The writer will be wrapped in a PrintWriter so line separation will be environment-specific.
Method Detail

writeDataSet

public void writeDataSet(DataSet ds)
                  throws SchemaWriterException
Writes the complete DataSet schema out as an XML Schema to the OutputStream or Writer this class was constructed with.

Specified by:
writeDataSet in interface DataSetSchemaWriter
Parameters:
ds - The DataSet to write out as a Schema.
Throws:
org.jdesktop.dataset.io.SchemaWriterException - If an error occurred while writing the schema.
SchemaWriterException - If any error occurs while writing the schema.

writeDataSet

public void writeDataSet(DataSet ds,
                         java.lang.String... tableNames)
                  throws SchemaWriterException
Writes the DataSet schema out as an XML Schema to the OutputStream or Writer this class was constructed with for the tables listed.

Specified by:
writeDataSet in interface DataSetSchemaWriter
Parameters:
ds - The DataSet to write as a schema.
tableNames - The DataTable names to include in the schema; includes their relations.
Throws:
org.jdesktop.dataset.io.SchemaWriterException - If an error occurred while dumping.
SchemaWriterException - If any error occurs while exporting the schema.


Copyright © 2005 Sun Microsystems All Rights Reserved.