views:

440

answers:

4

Hi,

Does anyone know of a method, or library, to convert SGML into XML?

EDIT: For clarification, I have to do the conversion in Java, and I cannot use the SP parser or the related SX tool.

A: 

The answer is not always that simple, as it depends on the sgml DTD. I haven't actually found a general SGML parser in Java at all, but this article uses SP which includes a converter.

Kathy Van Stone
If only I could use SX to do the conversion, I would be a happy man. I'm restricted to having to use Java to do the conversion.
sgrassie
Why? Can you call SX from Java instead?
Kathy Van Stone
A: 

See http://jclark.com/sp/sx.htm for the SX converter from SGML to XML in the SP package.

Thorbjørn Ravn Andersen
A: 

Would using XSLT be an idea?

XSLT could convert from XML to SGML (including variants that are not simply copying), but not the other way.
Kathy Van Stone
A: 

It seems that the general consensus is that there are no existing libraries for doing SGML work in Java. Certainly after several days of fruitlessly searching Google, and asking this question here, I have found no resources on this subject.

sgrassie