3

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.

Stuart Grassie
  • 3,043
  • 1
  • 27
  • 36
  • SGML is a superset of XML; what would you want the semantics of the conversion to be? Is there some specified transform you want? – Calum Oct 01 '09 at 14:31
  • I know it is a superset of XML. The semantics of the conversion I would like to perform are that the resultant XML is well formed - it doesn't necessarily have to validate against a schema. – Stuart Grassie Oct 01 '09 at 14:47

5 Answers5

4

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.

Stuart Grassie
  • 3,043
  • 1
  • 27
  • 36
0

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
  • 25,531
  • 3
  • 32
  • 40
0

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

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
0

There is the mlParser, but I'm having a hard time trying to locate it: http://www.balisage.net/Proceedings/vol1/html/Smith01/BalisageVol1-Smith01.html

user183037
  • 2,549
  • 4
  • 31
  • 42
0

There is no api for parsing SGML using Java at this time. There also isn't any api or library for converting SGML to XML and then parsing it using Java. With the status of SGML being supplanted by XML for all the projects I've worked on until now, I don't think there will every be any work done in this area, but that is only a guess.

Here is some open source code code from a University that does it, however I haven't tried it and you would have to search to find the other dependent classes. I believe the only viable solution in Java would require Regular Expressions.

Also, here is a link for public SGML/XML software.

James Drinkard
  • 15,342
  • 16
  • 114
  • 137