Class XMLInstance2Schema
- java.lang.Object
-
- org.exolab.castor.xml.schema.util.XMLInstance2Schema
-
public class XMLInstance2Schema extends java.lang.ObjectA 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();- Version:
- $Revision: 7996 $ $Date: 2006-01-16 13:22:58 -0700 (Mon, 16 Jan 2006) $
- Author:
- Keith Visco
-
-
Constructor Summary
Constructors Constructor Description XMLInstance2Schema()Creates a new XMLInstance2Schema
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SchemacreateSchema(java.io.Reader reader)Creates an XML Schema using the given Reader.SchemacreateSchema(java.lang.String filename)Creates an XML Schema using the given XML instance filename.SchemacreateSchema(org.xml.sax.InputSource source)Creates an XML Schema using the given InputSource.static voidmain(java.lang.String[] args)For testing purposes only.voidserializeSchema(java.io.Writer dstWriter, Schema schema)Serializes aSchemainstance to the givenWriterinstance.voidsetDefaultGroupingAsAll()Sets the default grouping as "all".
-
-
-
Method Detail
-
createSchema
public Schema createSchema(java.lang.String filename) throws java.io.IOException
Creates an XML Schema using the given XML instance filename. The XML Schema created will be based on the specific XML instance document.- Parameters:
filename- the filename for the XML document- Throws:
java.io.IOException
-
createSchema
public Schema createSchema(java.io.Reader reader) throws java.io.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.- Parameters:
reader- the Reader for the XML document- Throws:
java.io.IOException
-
createSchema
public Schema createSchema(org.xml.sax.InputSource source) throws java.io.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.- Parameters:
source- the InputSource for the XML document- Throws:
java.io.IOException
-
setDefaultGroupingAsAll
public void setDefaultGroupingAsAll()
Sets the default grouping as "all". By default groups will be treated as "sequence".
-
serializeSchema
public void serializeSchema(java.io.Writer dstWriter, Schema schema) throws java.io.IOException, org.xml.sax.SAXExceptionSerializes aSchemainstance to the givenWriterinstance.- Parameters:
dstWriter- TheWriterinstance to output the XML schema to.schema- The XMLSchemainstance to be output.- Throws:
java.io.IOException- If there's a problem related to writing to the givenWriterinstance.org.xml.sax.SAXException- If there's a problem related to SAX streaming.
-
main
public static void main(java.lang.String[] args)
For testing purposes only.
-
-