cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

SGML DTD to XML DTD

ptc-2017008
1-Newbie

SGML DTD to XML DTD

How to convert sgml dtd to xml dtd.Are there any tools to make this converision?

5 REPLIES 5

Robin,

There may be now, but I seriously doubt it. SGML DTDs (even XML DTDs) are becoming dinosaurs.

A couple of simple things you can do to begin with are:
1. Remove all tag minimization markers (the - - or - O)
2. Find all your 'inclusions' and 'exclusions' and come up with a plan on how to integrate those into your XML DTD. This is probably the most difficult part of the process (IMHO).
3. Be ready to change numerous ATTRIBUTE types in your ATTLISTs to support the reduced number (went from something like 14 to 7 if memory serves me correctly). Global search and replace will fix this pretty quickly.
4. If you have any mixed content models, make sure that the "#PCDATA" is the FIRST item in the 'or' group. Also the mixed data model is optional and repeatable (a "*") and CANNOT BE required (the "+").
5. Be prepared to include a SYSTEM identifier in your DOCTYPE header or declaration subset for local ENTITIES (Epic is rather forgiving on this, but other parsers will complain if it isn't there). 

This should get you down to things that cannot be found with search and replace actions. Then it is just a thing of fine tuning the DTD for XML.

Lynn
---- robin sun <sunbin928@126.com> wrote:
> How to convert sgml dtd to xml dtd. Are there any tools to make this converision?
>
>      
> ----------     

If you have inclusions or exclusions in your content model, you'll need to adjust your content models to remove them. If you're working on a DTD with a lot of them (anything military comes to mind) and a large set of legacy data, I'll light a candle for you...

Arbortext Architect might have some functionality that would help this, in that if you try to compile an XML doctype as SGML, it might start spitting out errors that you could fix one-at-a-time to eventually get you there. Even if you don't have or can't get Architect, you could probably just try renaming and compiling an xml doctype in Arbortext Editor and you might still get similar errors. If any of this works at all, sometimes the errors might be cryptic, so some SGML/XML knowledge would be useful in deciphering the error messages.

Robin,

I went through this about 2 years ago. I had to convert about 7 SGML DTDs to XML. I used this article as a type of checklist and just went one item at a time.

There used to be an excellent article by Eve Maler on the Arbortext site that covered the issues involved, but I can't find it now. But here's another link that could be helpful:

Top Tags