public class Converter
extends java.lang.Object
| Modifier and Type | Field | Description | 
|---|---|---|
static java.lang.String | 
DEFAULT_NAME_SPACE | 
|
static java.lang.String | 
DEFAULT_NAME_SPACE_PREFIX | 
|
static java.lang.String | 
NAME_SPACE_KEY | 
|
static java.lang.String | 
NAME_SPACE_PREFIX_KEY | 
| Constructor | Description | 
|---|---|
Converter() | 
| Modifier and Type | Method | Description | 
|---|---|---|
AttributeDecl | 
convertAttribute(Attribute dtdAttribute,
                Schema schema) | 
 Convert DTD Attribute declaration to Schema Attribute Declaration. 
 | 
Particle | 
convertContentParticle(ContentParticle dtdContent,
                      Schema schema) | 
 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. | 
ElementDecl | 
convertDTDElementToSchemaElement(Element dtdElement,
                                Schema schema) | 
 Convert DTD Element declaration to Schema Element Declaration. 
 | 
Schema | 
convertDTDObjectToSchemaObject(DTDdocument dtd,
                              java.lang.String targetNamespace,
                              java.util.Map nameSpaceMap) | 
 Convert DTD document object to corresponding Schema object. 
 | 
void | 
convertDTDtoSchema(java.io.Reader reader,
                  java.io.Writer writer) | 
 Convert DTD document to corresponding XML Schema document. 
 | 
void | 
convertDTDtoSchema(java.io.Reader reader,
                  java.io.Writer writer,
                  java.lang.String targetNameSpace,
                  java.util.Map<java.lang.String,java.lang.String> nameSpaceMap) | 
 Convert DTD document to corresponding XML Schema document. 
 | 
protected static boolean | 
isNameSpacePrefix(java.lang.String nameSpacePrefix2test) | 
|
static void | 
main(java.lang.String[] args) | 
 Simple command line interface to read an XML DTD file and create
 corresponding XML Schema file. 
 | 
void | 
marshalSchema(Schema schema,
             java.io.Writer writer) | 
 Marshals XML Schema to output char stream. 
 | 
DTDdocument | 
parseDTD(java.io.Reader reader) | 
 Parses text of a DTD document and returns corresponding DTD document
 object. 
 | 
protected static java.util.Map<java.lang.String,java.lang.String> | 
parseNamespace(java.lang.String nameSpaceArg) | 
|
void | 
process(java.io.Reader in,
       java.io.Writer out,
       java.lang.String encoding,
       java.lang.String targetNamespace,
       java.util.Map<java.lang.String,java.lang.String> namespaces) | 
|
void | 
process(java.lang.String dtdFile,
       java.lang.String schemaFile,
       java.lang.String encoding,
       java.lang.String targetNamespace,
       java.util.Map<java.lang.String,java.lang.String> namespaces) | 
public static final java.lang.String NAME_SPACE_PREFIX_KEY
public static final java.lang.String NAME_SPACE_KEY
public static final java.lang.String DEFAULT_NAME_SPACE_PREFIX
public static final java.lang.String DEFAULT_NAME_SPACE
public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        DTDException,
                        SchemaException,
                        org.xml.sax.SAXException
 java org.exolab.castor.xml.dtd.Converter  dtd_file xsd_file [character_encoding]
    [-tns=[TNS_PREFIX:]NAMESPACE_URI]
    [-xmlns=[TNS_PREFIX:]NAMESPACE_URI]*
 
 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.org.xml.sax.SAXException - if an error occured during marshalling of schema object
             constructed from the DTD document.java.io.IOExceptionpublic void process(java.lang.String dtdFile,
                    java.lang.String schemaFile,
                    java.lang.String encoding,
                    java.lang.String targetNamespace,
                    java.util.Map<java.lang.String,java.lang.String> namespaces)
             throws SchemaException,
                    DTDException,
                    java.io.IOException,
                    org.xml.sax.SAXException
dtdFile - Location of the DTD file.schemaFile - Location of the XML schema file.encoding - (Optional) encoding.targetNamespace - (Optional) target name space.namespaces - (Optional) XML name spaces.SchemaExceptionDTDExceptionjava.io.IOExceptionorg.xml.sax.SAXExceptionpublic void process(java.io.Reader in,
                    java.io.Writer out,
                    java.lang.String encoding,
                    java.lang.String targetNamespace,
                    java.util.Map<java.lang.String,java.lang.String> namespaces)
             throws SchemaException,
                    DTDException,
                    java.io.IOException,
                    org.xml.sax.SAXException
in - Location of the DTD file.out - Location of the XML schema file.encoding - (Optional) encoding.targetNamespace - (Optional) target name space.namespaces - (Optional) XML name spaces.SchemaExceptionDTDExceptionjava.io.IOExceptionorg.xml.sax.SAXExceptionprotected static java.util.Map<java.lang.String,java.lang.String> parseNamespace(java.lang.String nameSpaceArg)
protected static boolean isNameSpacePrefix(java.lang.String nameSpacePrefix2test)
public void convertDTDtoSchema(java.io.Reader reader,
                               java.io.Writer writer,
                               java.lang.String targetNameSpace,
                               java.util.Map<java.lang.String,java.lang.String> nameSpaceMap)
                        throws DTDException,
                               SchemaException,
                               java.io.IOException,
                               org.xml.sax.SAXException
reader - reader of the input DTD document.writer - writer to the output Schema document.targetNameSpaceMap - (Optional) XML target name space for the XML schema.nameSpaceMap - (Optional) XML name space declarations for the XML schema.DTDException - if the DTD document is syntactically or semantically not
             correct.SchemaException - if Schema object can not be created.java.io.IOException - if there is an I/O problem with the reader or
             writer.org.xml.sax.SAXException - if an error occured during schema object marshalling.public void convertDTDtoSchema(java.io.Reader reader,
                               java.io.Writer writer)
                        throws DTDException,
                               SchemaException,
                               java.io.IOException,
                               org.xml.sax.SAXException
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.java.io.IOException - if there is an I/O problem with the reader or
             writer.org.xml.sax.SAXException - if an error occured during schema object marshalling.public DTDdocument parseDTD(java.io.Reader reader) throws DTDException
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.public Schema convertDTDObjectToSchemaObject(DTDdocument dtd, java.lang.String targetNamespace, java.util.Map nameSpaceMap) throws DTDException, SchemaException
dtd - input XML DTD document object.nameSpacePrefix - nameSpace - DTDException - if the input DTD document is malformed.SchemaException - if Schema object can not be created.public ElementDecl convertDTDElementToSchemaElement(Element dtdElement, Schema schema) throws DTDException, SchemaException
dtdElement - DTD Element declaration.schema - Schema owning 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.public Particle convertContentParticle(ContentParticle dtdContent, Schema schema) throws DTDException, SchemaException
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.Group class or
         ElementDecl
         class.DTDException - if the input ContentParticle is malformed.SchemaException - if unable to construct return content object from a given
             ContentParticlepublic AttributeDecl convertAttribute(Attribute dtdAttribute, Schema schema) throws DTDException
dtdAttribute - DTD Attribute declaration.schema - Schema owning Element of this Attribute.DTDException - if the input DTD Attribute Declaration is malformed.public void marshalSchema(Schema schema, java.io.Writer writer) throws java.io.IOException, org.xml.sax.SAXException
schema - XML Schema object to marshal.writer - output char stream to marshal Schema to.java.io.IOException - if there is an I/O problem with the writer.org.xml.sax.SAXException - if an error occured during schema marshalling.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com