org.exolab.castor.xml.schema.util
Class XMLInstance2Schema
java.lang.Object
org.exolab.castor.xml.schema.util.XMLInstance2Schema
public class XMLInstance2Schema
extends java.lang.Object
A class for reading XML Schemas.
To generate an XML schema from a given XML document instance and write it to
a file, please use code similar to the following:
InputSource inputSource = ...;
XMLInstance2Schema xi2s = new XMLInstance2Schema();
Schema schema = xi2s.createSchema(inputSource);
Writer dstWriter = new FileWriter(...);
xi2s.serializeSchema(dstWriter, schema);
dstWriter.close();
$Revision: 7410 $ $Date: 2006-01-16 13:22:58 -0700 (Mon, 16 Jan
2006) $
XMLInstance2Schema
public XMLInstance2Schema()
Creates a new XMLInstance2Schema
createSchema
public Schema createSchema(InputSource source)
throws IOException
Creates an XML Schema using the given InputSource. The InputSource must
be for an XML instance document. The XML Schema created will be based on
the specific XML instance document.
source
- the InputSource for the XML document
createSchema
public Schema createSchema(Reader reader)
throws IOException
Creates an XML Schema using the given Reader. The reader must be for an
XML instance document. The XML Schema created will be based on the
specific XML instance document.
reader
- the Reader for the XML document
createSchema
public Schema createSchema(String filename)
throws IOException
Creates an XML Schema using the given XML instance filename. The XML
Schema created will be based on the specific XML instance document.
filename
- the filename for the XML document
main
public static void main(args[] )
For testing purposes only.
serializeSchema
public void serializeSchema(Writer dstWriter,
Schema schema)
throws IOException,
SAXException
Serializes a
Schema
instance to the given
Writer
instance.
dstWriter
- The Writer
instance to output the XML schema to.schema
- The XML Schema
instance to be output.
setDefaultGroupingAsAll
public void setDefaultGroupingAsAll()
Sets the default grouping as "all". By default groups will be treated as
"sequence".
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com