Need help with converting SGML DTD to Schema using Visual Studio Community

AndrewB 21 Reputation points
2021-05-26T13:28:34.573+00:00

Currently using Visual Studio Community Version, and I am trying to generate a Schema from SGML DTD.

When I open the SGML DTD I receive a ton of errors for example:
expecting system literal string,
Invalid token '>' at root level of document,
expecting keyword EMPTY or ANY. and so forth.

The DTD i have is valid in the SGML world.

When I go to XML - Create Schema, it generates a XSD Schema version of the SGML DTD however it does not generate <xs: sequence ref="xxxx"> information for required elements like the SGML DTD.

Is there some setup i am missing to prevent the SGML DTD errors when opening the file?
Is there some setup on the Create Schema that i need to receive the desired output?

Any Help would greatly be appreciated

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,439 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 45,091 Reputation points
    2021-05-26T13:37:30.717+00:00

    AFAIK you cannot convert an SGML DTD to XSD in VS in all cases. There is an option to create a schema but I haven't heard that it actually works correctly with the SGML format. SGML is more loose than XML and therefore conversion issues can occur the further from pure XML the SGML is. Of course you could use VS to convert the bulk of the DTD and then fix up whatever is left but I don't know a good way to verify this.

    You could try to first convert the SGML DTD to a regular XML DTD and then use VS as well.

    Finally there may be some online converters that could do it as well if the DTD is really large.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AndrewB 21 Reputation points
    2021-05-26T13:46:03.147+00:00

    I haven't much luck finding other Software besides VS to actually convert the DTD to Schema.
    I was hoping it wouldn't come to the manual effort as I will have a lot of DTDs to convert.

    I will look into the SGML DTD to XML DTD option. Thanks

    0 comments No comments