Jump to content

What exactly is SGML?


maidenforce19

Recommended Posts

I just learned how to write basic HTML so I am a complete newb, but as I was looking up information on the history of html on the web I saw a markup language called SGML that HTML is based off of. Now, I am confused. Is SGML a language that can be used by itself to make something (like a web site or a program)? Or is it a general language that can't actually do anything (at least nowadays) by itself, but other languages are based off of it? What exactly is SGML? And how is it different than HTML?

Link to comment
Share on other sites

I just learned how to write basic HTML so I am a complete newb, but as I was looking up information on the history of html on the web I saw a markup language called SGML that HTML is based off of. Now, I am confused. Is SGML a language that can be used by itself to make something (like a web site or a program)? Or is it a general language that can't actually do anything (at least nowadays) by itself, but other languages are based off of it? What exactly is SGML? And how is it different than HTML?
HTML is a subset of SGML. You will never use SGML in your life so forget about it<g>.
Link to comment
Share on other sites

That's not a great answer.If you really do know about SGML, would you care to explain about it?I researched it myself a long time ago to see what it was, and all I found was an explanation of the HTML DTD.

Link to comment
Share on other sites

That's not a great answer.If you really do know about SGML, would you care to explain about it?I researched it myself a long time ago to see what it was, and all I found was an explanation of the HTML DTD.
Sorry you didn't like it. SGML's specs run to 500 pages and that was 10 years ago. While you might want to write a DTD to access parts of it for your own version of HTML, I doubt anyone else would. It is not very practical for 99.999999% of the people, specifically including web designers, to know any of the details. I certainly don't know or care about the details of SGML other than as a trivia question.The initial poster didn't indicate that he wanted to develop his own version of HTML so details didn't seem important.
Link to comment
Share on other sites

Sorry you didn't like it. SGML's specs run to 500 pages and that was 10 years ago. While you might want to write a DTD to access parts of it for your own version of HTML, I doubt anyone else would. It is not very practical for 99.999999% of the people, specifically including web designers, to know any of the details. I certainly don't know or care about the details of SGML other than as a trivia question.The initial poster didn't indicate that he wanted to develop his own version of HTML so details didn't seem important.
Once again, I'll say that I'm a newb. I JUST started learning HTML, so I'm very new to all these terms. I'm sorry if I sound too beginner to you, but I'm not familiar with the term DTD. What does it stand for and what does it mean? And what does it mean to develop your own version of HTML?
I didn't mean to offend. I just was more interested in seeing an answer that would explain basically what it's used for.
And yes, my original question was what SGML is and what it's used for. And while you brought up more questions that are interesting, my original question wasn't really answered yet.
Link to comment
Share on other sites

Once again, I'll say that I'm a newb. I JUST started learning HTML, so I'm very new to all these terms. I'm sorry if I sound too beginner to you, but I'm not familiar with the term DTD. What does it stand for and what does it mean? And what does it mean to develop your own version of HTML?And yes, my original question was what SGML is and what it's used for. And while you brought up more questions that are interesting, my original question wasn't really answered yet.
I Googled SGML and found this site. You might find more information, if you do the same.SGML at Wikipedia
Link to comment
Share on other sites

Basically, it is an old markup language that has been superseded by XML. It is less strict than XML, but can be used for the same purposes, such as data storage or metadescription.A DTD (Document Type Definition) is a description of a markup language. HTML is described in a certain way, but if you wanted to add your own elements or attributes then you could create a custom DTD.

Link to comment
Share on other sites

A really more concrete definition that applies to SGML (as well as XML) is that it is "a set of rules for defining markup languages".SGML rules are more complex, and thus harder for programmers to implement. XML took only the best parts from SGML and adjusted them to make them even more easily implementable.HTML is a markup language that derives from SGML, and thus, in theory, an HTML parser* is also an SGML parser. In practice, HTML parsers in browsers as we know them today are not really SGML parsers. They implement their own subset of SGML rules that differs from one implementation to the next.XHTML on the other hand derives from XML. In both theory and practice, XHTML parsers are also XML parsers. That's because XML was far easier for all browser vendors to implement correctly and consistently. There's a little problem with using a real XHTML today often reffered to as "the MIME type issue", but in short - XHTML as we know it today in IE is not true XHTML. The only way to give any XHTML to IE is to give it XHTML that would get parsed as HTML, loosing everything new from XHTML in the process.As for the mentioned DTD. DTD or Document Type Defintion is part of SGML that is used to declare what elements and attributes are allowed in the language. For example, the HTML DTD declares that the "html" element must be the root, most outer element in an HTML document. DTD also specifies what and where can be omitted. This alone is what made SGML complex (I'd say 99% of SGML's complexity is due to its ability to omit almost everything). DTD as implemented in XML can only declare what is allowed and where, thus simplifying XML parsing and implementation.* A "parser" is a program that takes some text and translates it into something that another program/language can understand. In the case of (X)HTML, this is a representation known as a "DOM tree" which the browser can use to visualize the page. In traditional programming languages, instead of "DOM tree" you have "tokens". If you didn't get that last part, don't worry. You'll understand it later when you start PHP.

Link to comment
Share on other sites

Once again, I'll say that I'm a newb. I JUST started learning HTML, so I'm very new to all these terms. I'm sorry if I sound too beginner to you, but I'm not familiar with the term DTD. What does it stand for and what does it mean? And what does it mean to develop your own version of HTML?And yes, my original question was what SGML is and what it's used for. And while you brought up more questions that are interesting, my original question wasn't really answered yet.
That one is more important, but you don't need to know anything about it other than you need it. The document type definition is used to tell the browser what to do with the document (web page in this case). Without a DOCTYPE statement, the browser will use their own decisions on how your page should look and every browser has different ways to look at it.w3school doctypeThis is essential so that you know what you design is what they see. Personally, I use strict for testing the page (Validate your page) and ignore a few of the errors that I know are OK for my purposes and then use transitional for the "clean" test.When you get into it more, you will test your css here: Validate your css but don't ask me why they have it at a goofy site like "jigsaw".
Link to comment
Share on other sites

A DTD (Document Type Definition) is a description of a markup language. HTML is described in a certain way, but if you wanted to add your own elements or attributes then you could create a custom DTD.
Are there any examples on the web of custom DTDs? I'm still kind of confused as to what they do.
Link to comment
Share on other sites

Google search found 1.3 million hits on custom dtd. Enjoy.http://www.google.com/search?hl=en&q=c...mp;oq=custom+dtAre you seriously going to try to invent your own web language?
Lol no. I think I have a brief understanding of what it is now. I didn't know what it was at first and when I googled it (didn't need the link) I couldn't find any examples per say. That link just gave more of the same. But no, I'm not making my own web language.Ok, so basically SGML is what makes HTML possible. And while you can't use it by itself for any conventional means except for rare circumstances such as creating custom DTDs, it's necessary for everything that uses it, like a foundation. Is this correct?
Link to comment
Share on other sites

Lol no. I think I have a brief understanding of what it is now. I didn't know what it was at first and when I googled it (didn't need the link) I couldn't find any examples per say. That link just gave more of the same. But no, I'm not making my own web language.Ok, so basically SGML is what makes HTML possible. And while you can't use it by itself for any conventional means except for rare circumstances such as creating custom DTDs, it's necessary for everything that uses it, like a foundation. Is this correct?
Sounds right to me. If you are not a browser developer, chances are you will never need it. I've been in the field since the 70s and I've never come across anyone that ever did a single thing in SGML or DTD.
Link to comment
Share on other sites

Ok, so basically SGML is what makes HTML possible. And while you can't use it by itself for any conventional means except for rare circumstances such as creating custom DTDs, it's necessary for everything that uses it, like a foundation. Is this correct?
Well, you could use SGML by itself if you had an SGML parser within your environment (e.g. JavaScript, PHP, C++, etc.), but there are very few out there, most (if not all) of which don't support the full SGML features.The whole point of both SGML and XML is that this "foundation" can be understood by any such generic program and be built upon.I can't really give an example with SGML since it never took off, but with XML, if you have a certain XHTML document, you can use an XML parser to extract certain portions of it which you can later use. For example, you can extract the first paragraph of a big XHTML document, and write it inside another "reduced" version optimized for mobile phones. And you can do the same for SVG documents. Without XML being the foundation, you'd need a special XHTML parser or another special SVG parser.SGML serves the same purpose as XML. It's just that it's the old school of it. As far as DTD goes, as said already, it just declares what elements and attributes can the document contain. It says that <title> is only allowed in the <head>, that the <body> is only inside the <html> and so forth. You only need to write a custom DTD if you want to make a certain element/attribute appear valid. Note that even if you do so, that still doesn't tell browsers what to do with this new element/attribute.
Link to comment
Share on other sites

A custom DTD would be useful if you ALSO had a custom parser (e.g., a web browser) and a client base to support it. You can't just create a custom DTD and expect Firefox to implement it by some sort of magic. There has to be deliberate coordination. The application must support the DTD. If that wasn't true, we'd all be writing our own custom DTDs to get around the weaknesses of certain browsers.On the other hand, if you were a large institution with seriously unique needs (a big corporation or university maybe) it might be useful to create a custom DTD and implement it in your own adaptation of the open-source Mozilla, say. A big project, but doable.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...