Static Public Member Functions

org.exolab.castor.xml.dtd.Converter Class Reference

List of all members.

Static Public Member Functions

static void main (String args[]) throws IOException, DTDException, SchemaException, SAXException
static void convertDTDtoSchema (Reader reader, Writer writer) throws DTDException, SchemaException, IOException, SAXException
static DTDdocument parseDTD (Reader reader) throws DTDException
static Schema convertDTDObjectToSchemaObject (DTDdocument dtd) throws DTDException, SchemaException
static ElementDecl convertDTDElementToSchemaElement (Element dtdElement, Schema schema) throws DTDException, SchemaException
static Particle convertContentParticle (ContentParticle dtdContent, Schema schema) throws DTDException, SchemaException
static AttributeDecl convertAttribute (Attribute dtdAttribute, Schema schema) throws DTDException
static void marshalSchema (Schema schema, Writer writer) throws IOException, SAXException

Detailed Description

Class containing static top-level methods to parse and convert XML DTD documents to corresponding XML Schema documents. Also contains simple command line interface to read an XML DTD file and create corresponding XML Schema object.

Author:
Alexander Totok
Version:
Revision:
1.3
Date:
2004/06/23 04:17:36

Member Function Documentation

static AttributeDecl org.exolab.castor.xml.dtd.Converter.convertAttribute ( Attribute  dtdAttribute,
Schema  schema 
) throws DTDException [static]
static Particle org.exolab.castor.xml.dtd.Converter.convertContentParticle ( ContentParticle  dtdContent,
Schema  schema 
) throws DTDException, SchemaException [static]

Method to convert ContentParticle object, used to implement element content in the DTD object model, to the corresponding object in the Schema object model: either Group or ElementDecl.

Parameters:
dtdContent input ContentParticle object.
Returns:
object returned is an instance of either Group class or ElementDecl class.
Exceptions:
DTDException if the input ContentParticle is malformed.
SchemaException if unable to construct return content object from a given ContentParticle

References org.exolab.castor.xml.schema.Group.addElementDecl(), org.exolab.castor.xml.schema.Group.addGroup(), org.exolab.castor.xml.schema.Particle.setMaxOccurs(), org.exolab.castor.xml.schema.Particle.setMinOccurs(), org.exolab.castor.xml.schema.Group.setOrder(), and org.exolab.castor.xml.schema.ElementDecl.setReference().

Referenced by org.exolab.castor.xml.dtd.Converter.convertDTDElementToSchemaElement().

static ElementDecl org.exolab.castor.xml.dtd.Converter.convertDTDElementToSchemaElement ( Element  dtdElement,
Schema  schema 
) throws DTDException, SchemaException [static]
static Schema org.exolab.castor.xml.dtd.Converter.convertDTDObjectToSchemaObject ( DTDdocument  dtd  )  throws DTDException, SchemaException [static]

Convert DTD document object to corresponding Schema object.

Parameters:
dtd input XML DTD document object.
Returns:
corresponding XML Schema object.
Exceptions:
DTDException if the input DTD document is malformed.
SchemaException if Schema object can not be created.

References org.exolab.castor.xml.schema.AnnotationItem.add(), org.exolab.castor.xml.schema.Annotated.addAnnotation(), org.exolab.castor.xml.schema.Annotation.addDocumentation(), org.exolab.castor.xml.schema.Schema.addElementDecl(), org.exolab.castor.xml.dtd.Converter.convertDTDElementToSchemaElement(), and org.exolab.castor.xml.schema.Schema.setId().

Referenced by org.exolab.castor.xml.dtd.Converter.convertDTDtoSchema().

static void org.exolab.castor.xml.dtd.Converter.convertDTDtoSchema ( Reader  reader,
Writer  writer 
) throws DTDException, SchemaException, IOException, SAXException [static]

Convert DTD document to corresponding XML Schema document.

Parameters:
reader reader of the input DTD document.
writer writer to the output Schema document.
Exceptions:
DTDException if the DTD document is syntactically or semanticly not correct.
SchemaException if Schema object can not be created.
IOException if there is an I/O problem with the reader or writer.
SAXException if an error occured during schema object marshalling.

References org.exolab.castor.xml.dtd.Converter.convertDTDObjectToSchemaObject(), org.exolab.castor.xml.dtd.Converter.marshalSchema(), and org.exolab.castor.xml.dtd.Converter.parseDTD().

Referenced by org.exolab.castor.xml.dtd.Converter.main().

static void org.exolab.castor.xml.dtd.Converter.main ( String  args[]  )  throws IOException, DTDException, SchemaException, SAXException [static]

Simple command line interface to read an XML DTD file and create corresponding XML Schema file. Usage:

 java org.exolab.castor.xml.dtd.Converter  dtd_file xsd_file [character_encoding]
 dtd_file: name of the input DTD file
 xsd_file: name of the output Schema file
 character_encoding: name of the character encoding,
            if not specified, ASCII is chosen

Help message is provided.

Exceptions:
DTDException if the input DTD document is malformed.
SchemaException if Schema object can not be created.
SAXException if an error occured during marshalling of schema object constructed from the DTD document.

References org.exolab.castor.xml.dtd.Converter.convertDTDtoSchema().

static void org.exolab.castor.xml.dtd.Converter.marshalSchema ( Schema  schema,
Writer  writer 
) throws IOException, SAXException [static]

Marshals XML Schema to output char stream.

Parameters:
schema XML Schema object to marshal.
writer output char stream to marshal Schema to.
Exceptions:
IOException if there is an I/O problem with the writer.
SAXException if an error occured during schema marshalling.

References org.exolab.castor.xml.schema.writer.SchemaWriter.write().

Referenced by org.exolab.castor.xml.dtd.Converter.convertDTDtoSchema().

static DTDdocument org.exolab.castor.xml.dtd.Converter.parseDTD ( Reader  reader  )  throws DTDException [static]

Parses text of a DTD document and returns corresponding DTD document object. It is left to constructor of the reader to set up character encoding correctly. This means that method <u><font color="blue">read</font></u> of the reader is used to get next character, assuming it returns appropriate values.

Parameters:
reader input char stream reader. It is recommended to use class java.io.InputStreamReader as a reader, which allows to set desired character encoding.
Returns:
DTD document object corresponding to the input text of a DTD document.
Exceptions:
DTDException if the DTD document is syntactically or semanticly not correct.

References org.exolab.castor.xml.dtd.parser.ParseException.getMessage(), org.exolab.castor.xml.dtd.parser.TokenMgrError.getMessage(), org.exolab.castor.xml.dtd.parser.DTDParser.Input(), and org.exolab.castor.xml.dtd.parser.DTDInitialParser.Input().

Referenced by org.exolab.castor.xml.dtd.Converter.convertDTDtoSchema().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties