I'm trying to convert a dtd to an xsd to be able to do my mapping.

 

Here is my DTD: 

==================================

<?xml version="1.0" encoding="UTF-8"?>

<!-- TypesReply-->

<!ELEMENT TypesReply (CommonReply, (ReplyData | Error))>

<!ENTITY % CommonReply SYSTEM "CommonReply.dtd">

%CommonReply;

<!ELEMENT ReplyData (Type*)>

<!ELEMENT Type (ID, Description)>

<!ELEMENT ID (#PCDATA)>

<!ELEMENT Description (#PCDATA)> 

==================================

 

 

Here is the CommonReply DTD:

==================================

<?xml version="1.0" encoding="UTF-8"?>

<!-- $Revision: 1.1 $ -->

<!-- Common reply DTD, containing elements common to the reply of all
transactions -->

<!ELEMENT CommonReply (TxNumber,(TxUUID | UserID))>

<!ELEMENT TxNumber (#PCDATA)>

<!ELEMENT TxUUID (#PCDATA)>

<!ELEMENT UserID (#PCDATA)>

<!ELEMENT Error (ErrorCode, ErrorMsg)>

<!ELEMENT ErrorCode (#PCDATA)>

<!ELEMENT ErrorMsg (#PCDATA)> 

==================================

 

 

Here is my code:

==================================

try {

Converter dtdToSchemaConverter = new Converter();

String filename = "/full/path/to/dtd/typesReply.dtd";

String outputFileName = filename.replaceAll("dtd","xsd");

FileReader reader = new FileReader(filename);

FileWriter writer = new FileWriter(outputFileName);

dtdToSchemaConverter.convertDTDtoSchema(reader, writer);

 

} catch (Exception e) {

      e.printStackTrace();

}

==================================

 

 

This is the exception: 

==================================

org.exolab.castor.xml.dtd.DTDException: ParseException: Encountered
"SYSTEM" at line 5, column 24.

Was expecting one of:

    "\"" ...

    "\'" ...

    

      at
org.exolab.castor.xml.dtd.Converter.parseDTD(Converter.java:238)

      at
org.exolab.castor.xml.dtd.Converter.convertDTDtoSchema(Converter.java:17
3)

      at DynMethodCall.main(DynMethodCall.java:350)

==================================

 

 

Can someone tell me what I need to do to convert the DTDs I have to XSD
files, so I can do the mapping?

 

Thanks,

Walter

 

 

 

 

Reply via email to