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 |
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.
static AttributeDecl org.exolab.castor.xml.dtd.Converter.convertAttribute | ( | Attribute | dtdAttribute, | |
Schema | schema | |||
) | throws DTDException [static] |
Convert DTD Attribute declaration to Schema Attribute Declaration.
DTDException | if the input DTD Attribute Declaration is malformed. |
References org.exolab.castor.xml.schema.SimpleType.addFacet(), org.exolab.castor.xml.schema.AttributeDecl.getSimpleType(), org.exolab.castor.xml.schema.AttributeDecl.setDefaultValue(), org.exolab.castor.xml.schema.AttributeDecl.setSimpleType(), and org.exolab.castor.xml.schema.AttributeDecl.setUse().
Referenced by org.exolab.castor.xml.dtd.Converter.convertDTDElementToSchemaElement().
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.
dtdContent | input ContentParticle object. |
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] |
Convert DTD Element declaration to Schema Element Declaration.
DTDException | if the input DTD Element Declaration is malformed. | |
SchemaException | if unable to construct return ElementDecl object from the input DTD Element object. |
References org.exolab.castor.xml.schema.ComplexType.addAttributeDecl(), org.exolab.castor.xml.schema.Group.addElementDecl(), org.exolab.castor.xml.schema.ComplexType.addGroup(), org.exolab.castor.xml.schema.Group.addWildcard(), org.exolab.castor.xml.dtd.Converter.convertAttribute(), org.exolab.castor.xml.dtd.Converter.convertContentParticle(), org.exolab.castor.xml.schema.ContentType.elemOnly, org.exolab.castor.xml.schema.ElementDecl.getName(), org.exolab.castor.xml.schema.ContentType.mixed, org.exolab.castor.xml.schema.ComplexType.setContentType(), org.exolab.castor.xml.schema.Particle.setMaxOccurs(), org.exolab.castor.xml.schema.Particle.setMinOccurs(), org.exolab.castor.xml.schema.Group.setOrder(), org.exolab.castor.xml.schema.ElementDecl.setReference(), and org.exolab.castor.xml.schema.ElementDecl.setType().
Referenced by org.exolab.castor.xml.dtd.Converter.convertDTDObjectToSchemaObject().
static Schema org.exolab.castor.xml.dtd.Converter.convertDTDObjectToSchemaObject | ( | DTDdocument | dtd | ) | throws DTDException, SchemaException [static] |
Convert DTD document object to corresponding Schema object.
dtd | input XML DTD document object. |
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.
reader | reader of the input DTD document. | |
writer | writer to the output Schema document. |
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.
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.
schema | XML Schema object to marshal. | |
writer | output char stream to marshal Schema to. |
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.
reader | input char stream reader. It is recommended to use class java.io.InputStreamReader as a reader , which allows to set desired character encoding. |
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().