Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

there is a *.sgm file. It is my data set I want to convert it to any other type of data set, which make me able to have access to it with program like WEKA. Weka mainly support *.arff file.

share|improve this question
Can you provide more information - what software are you using, what OS etc. – davidgo Mar 28 '13 at 7:11

.sgm is a standard; it is a type of XML file. You could try renaming the file extension to .xml or .arff (if you're happy to lose the XML)!

share|improve this answer

SGML is the precursor standard to XML, which is often thought of as a simplified version of SGML. Depending on how it was authored, you can probably rename it to .xml and do some minor editing to make it valid XML.

SGML has several features, such as tag minimization, that aren't in XML. For example (IIRC), these would be equivalent to an SGML parser:

<para/This is a paragraph./>
<para>This is a paragraph.</para>

(I might have the syntax slightly wrong for the first one, it's been quite a while.)

SGML can also imply the presence of required elements, something that XML doesn't do (you'd have to explicitly include them).

First step would be to grab a text editor (or command-line tool like xmlwf), rename it to .xml, and try cleaning it up until you run out of syntax errors. Text processing tools like perl might make your life easier if the same sorts of errors happen many times (you didn't mention how large your SGML file was).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .