XML and "SGML CD"

This page describes what the software in "SGML CD" can offer to XML users.

PSGML

David Megginson (coincidentally, author of chapter six's "SGMLS.pm") has modified certain .el files in Lenart Stafflin's PSGML so that it can handle XML files. You must install it over release 1.0.1 or later of PSGML. See http://home.sprynet.com/sprynet/dmeggins/private/psgmlxml-19970812.zip. According to David, Lenart will incorporate this additions into future releases of PSGML.

Once I installed it, I found that taking some of my simpler SGML DTDs and documents and modifying them until they were valid XML was a great way to learn about XML. (Although I can't get it working this morning...as David's documentation warns, keep backups of the replaced psgml*.el files until all the kinks are worked out of the XML support.)

nsgmls

Version 1.2 lets you parse well-formed XML documents that have no DTD by including the -wno-valid option. When they do have a DTD, you need the xml.dcl SGML declaration file that comes with Jade (also available here). I couldn't get this to work with 1.2.1 of nsgmls, but I could with the unicode version, nsgmlsu:

nsgmlsu -s xml.dcl somefile.xml

Jade

According to its jade.htm documentation file, Jade 1.0.1 supports SGML to XML translations with the -t switch. It comes with the SGML declaration file xml.dcl that makes it easier (as we'll see below) to use a lot of SGML software with XML.

Perl SGML Tools

XML isn't an issue with sgmls.pl or sgmls.PM, because they're reading the ESIS output of nsgmls. All you need to do to process XML files with these perl tools is to use nsgmlsu with the xml.dcl SGML declaration as described above when feeding parsed data to your Perl application.

perlSGML DTD Analysis Tools

Some quick tests with the XML DTD shown below (and, for dtddiff, this DTD plus a variation on it) showed that it posed no problems for any of Earl Hood's dtdtree, dtd2html, dtdview, or dtddiff DTD analysis tools. (stripsgml, being the most forgiving all SGML utilities, naturally had no problem with it.) So it looks like XML developers can benefit from all of Earl Hood's tools with no special steps.

<?XML VERSION="1.0"?> 
<!DOCTYPE min [ 
<!ELEMENT min (div+)> 
<!ELEMENT div (p*)> 
<!ELEMENT p (#PCDATA|name|img)*> 
<!ELEMENT name (#PCDATA)> 
<!ELEMENT img EMPTY>
<!ATTLIST img file CDATA "sample.bmp">
]> 

SGMLC

SGMLC is currently undergoing a revision that will eventually let it handle XML input.