Maybe ommitting the <?xml ...?> instruction as per
http://castor.org/javadoc/org/exolab/castor/xml/dtd/package-summary.html#package_description
might help you ?
Werner
Walter Moore wrote:
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:173_)
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
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email