Re: [xsl] Convert SGML to XML using James Clarke's tool

Subject: Re: [xsl] Convert SGML to XML using James Clarke's tool
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Tue, 18 Aug 2009 18:56:08 +0200
sa ku schrieb:
I have a task of converting sgml to XML. The XML file has a schema
and the SGML file has a DTD<br><br>I downloaded James Clarke's tool.
But I am not clear as to how to run it. <br><br>Can anybody please
help me with a documentation that I can look at or with examples?

Both! The tool you want is sx. See:


http://www.jclark.com/sp/
http://www.jclark.com/sp/sx.htm

A simple example:

# type movie.dtd
<!ELEMENT movie         - O (name,length,rating)>
<!ELEMENT name          O O (#PCDATA)>
<!ELEMENT length        - O (#PCDATA)>
<!ELEMENT rating        - O (#PCDATA)>
<!ATTLIST length units (min|hour) min>

# type movie.sgml
<!DOCTYPE movie SYSTEM "movie.dtd">
<MOVIE>
Gladiator
<LENGTH UNITS="min">195
<RATING>MA

# sx movie.sgml
<?xml version="1.0"?>
<MOVIE
<NAME
Gladiator</NAME><LENGTH
UNITS="MIN"
195</LENGTH><RATING
MA</RATING></MOVIE>

-- Michael Ludwig

Current Thread