Discussion:
What is done with SGML declarations?
(too old to reply)
Eric Fields
2005-09-12 15:45:34 UTC
Permalink
I've been studying Goldfarbs "SGML Handbook" and the Recommendations on the
W3C website having to do with XHTML and XML.
A concept I don't understand is, what is done with the delcarations that are
created using SGML?
The following link http://www.w3.org/TR/html401/HTML4.decl is the SGML
declaration for HTML 4.01, but what is done with this declaration?
Is it something that is parsed by an application?
Is it a set of rules that a programmer uses to write an application?
I understand the in Basic, C, assembler and such that the code is written
and then compiled, assembled or interpreted while or before running the
program.
Is an SGML declaration to be looked at in the same way, as the source code
that is the input to something that interprets it?

If I had to guess I would say the the SGML declaration is used by a
programmer to write for instance a browser. It is the hardwired set of rules
written into the browser by the programmer who interpreted the declaration,
that, along with the documents DTD, the browser will use to parse the
incoming HTML document.

Just call me confused>

***@kc.rr.com
Dick Wesseling
2005-09-13 02:35:39 UTC
Permalink
Post by Eric Fields
I've been studying Goldfarbs "SGML Handbook" and the Recommendations on the
W3C website having to do with XHTML and XML.
A concept I don't understand is, what is done with the delcarations that are
created using SGML?
The following link http://www.w3.org/TR/html401/HTML4.decl is the SGML
declaration for HTML 4.01, but what is done with this declaration?
Is it something that is parsed by an application?
Is it a set of rules that a programmer uses to write an application?
I understand the in Basic, C, assembler and such that the code is written
and then compiled, assembled or interpreted while or before running the
program.
Is an SGML declaration to be looked at in the same way, as the source code
that is the input to something that interprets it?
Yes and no. And SGML declaration can be used as source code for a SGML
parser. After parsing the declaration, the parser will be able to parse a
document that conforms to the declaration. In other words, a declaration
is meta-source. If you want to compare SGML to general purpose programming
languages then a SGML parser is similar to a compiler writing tool such as
yacc and the DTD describes the grammar of the progrmming language to be
parsed.
Post by Eric Fields
If I had to guess I would say the the SGML declaration is used by a
programmer to write for instance a browser. It is the hardwired set of rules
written into the browser by the programmer who interpreted the declaration,
that, along with the documents DTD, the browser will use to parse the
incoming HTML document.
The parsing rules do not need to be hardwired into the browser. An advanced
browser could load a DTD on demand and use that DTD to parse a document.
However, parsing a document is the trivial part of the job. The hard
part is doing something useful with the parsed document. for instance
rendering the document. The rendering can be hardwired into the browser,
but it is also possible for the rendering to be controlled by a rendering
declaration: a style sheet.
Peter Flynn
2005-09-13 21:08:18 UTC
Permalink
Post by Eric Fields
I've been studying Goldfarbs "SGML Handbook" and the Recommendations on
the W3C website having to do with XHTML and XML.
A concept I don't understand is, what is done with the delcarations that
are created using SGML?
The following link http://www.w3.org/TR/html401/HTML4.decl is the SGML
declaration for HTML 4.01, but what is done with this declaration?
In an SGML application, the SGML Declaration is used by the parser to
set certain limits on the document, or to turn on or off certain features.

The limits are not really applicable nowadays: they were designed in the
days of fixed or very small memory environments where programs needed to
know ahead of time how much space they would need. The SGML Declaration
for XML, for example, sets all limits to 999999999 (in effect unlimited).

Optional features of SGML included markup minimization, case elision,
and a number of useful but rather specialist attribute types.

The SGML Declaration for an application (eg TEI, DocBook, HTML, etc) also
specifies the character set, and can even re-set the markup characters
(you could make markup use square brackets instead of pointy ones if
you wanted).
Post by Eric Fields
Is it something that is parsed by an application?
It's read and used by a parser. An "application" in SGML terms means
a type of document, not a program.
Post by Eric Fields
Is it a set of rules that a programmer uses to write an application?
No, usually it is defined by the document type designer, as part of the
rules for a specific DTD.
Post by Eric Fields
I understand the in Basic, C, assembler and such that the code is written
and then compiled, assembled or interpreted while or before running the
program.
Is an SGML declaration to be looked at in the same way, as the source code
that is the input to something that interprets it?
Almost. Think of it as a configuration file for a DTD.
Post by Eric Fields
If I had to guess I would say the the SGML declaration is used by a
programmer to write for instance a browser. It is the hardwired set of
rules written into the browser by the programmer who interpreted the
declaration,
that, along with the documents DTD, the browser will use to parse the
incoming HTML document.
Close, but it is a set of rules for the DTD, and therefore for the parser.
It has nothing to do with any program that receives the results of the
parse.

///Peter
Yarco
2005-09-26 05:12:35 UTC
Permalink
Hi peter,
Post by Peter Flynn
The SGML Declaration for an application (eg TEI, DocBook, HTML, etc) also
specifies the character set, and can even re-set the markup characters
(you could make markup use square brackets instead of pointy ones if
you wanted).

How to do this? Change character set.
Because i get some errors when doing my job not for english.
Peter Flynn
2005-09-26 23:18:21 UTC
Permalink
Post by Yarco
Hi peter,
Post by Peter Flynn
The SGML Declaration for an application (eg TEI, DocBook, HTML, etc) also
specifies the character set, and can even re-set the markup characters
(you could make markup use square brackets instead of pointy ones if
you wanted).
How to do this?
You should only do this if you are an experienced document type designer.
Changing the SGML Declaration is not for the weak-hearted :-)

And if you're using XML, you can't change it: it's fixed.
Post by Yarco
Change character set.
I wasn't entirely accurate when I said "character set". I should have said
"list of valid characters".

In XML you can change the character set in the XML Declaration, which is
a different thing to the SGML Declaration for XML.
Post by Yarco
Because i get some errors when doing my job not for english.
Use <?xml version="1.0"?> without specifying a character set, and
use a Unicode editor with Unicode fonts, then all the characters
will be right.

Don't try to use SGML for Unicode applications unless you like typing hex.

///Peter
Yarco
2005-09-27 00:03:06 UTC
Permalink
Oh Peter,
Do you mean if i want to get it work,

When under SGML:
I should redefine the dtd for MyCharset, and modify the SGML
declaration to support MyCharset.
When under XML:
I should use <?xml version="1.0" encoding="unicode"?>, and set charset
of editor to unicode.

Oh...xml might be easy to handle.
Peter Flynn
2005-09-27 22:32:03 UTC
Permalink
Post by Yarco
Oh Peter,
Do you mean if i want to get it work,
I should redefine the dtd for MyCharset,
You probably don't need to make any changes to your DTD.
Post by Yarco
and modify the SGML
declaration to support MyCharset.
Yes.
Post by Yarco
I should use <?xml version="1.0" encoding="unicode"?>, and set charset
of editor to unicode.
encoding="utf-8" or just omit it (UTF-8 is the default).
Post by Yarco
Oh...xml might be easy to handle.
Much easier.

///Peter

Jan Roland Eriksson
2005-09-27 20:17:18 UTC
Permalink
[Peter Flynn]
Post by Peter Flynn
The SGML Declaration for an application (eg TEI, DocBook, HTML, etc) also
specifies the character set, and can even re-set the markup characters
(you could make markup use square brackets instead of pointy ones if
you wanted).
How to do this? Change character set.
Because i get some errors when doing my job not for english.
First; note Peters additional info on his use of "character set" to mean
"characters valid for use in marked up content", do not confuse with
"character set" as used to describe "character encoding in transmission"

Second; I think it's good advise to take a step back and look at what
SGML really is as per definition.

SGML is a meta language defined in a very large set of keywords that
each one represents one tiny little aspect of an application of SGML.

In order to use SGML for any practical purpose you must define an
"Application of SGML" and such an application definition basically has
two components, the "SGML declaration" and the "Document Type
Definition"

The "SGML declaration" assigns "real world" values to SGML keywords and
the "Document Type Definition" defines the syntax of how to use those
"real world" values in practical markup.

These two components concatenated, and further concatenated with your
own marked up content constitutes one fully marked up SGML document.

Now for the keywords and how to assign values to them for practical use.

Let me illustrate with the following three keywords, probably the most
common ones in all applications of SGML markup.

SGML aspect "Start Tag Open" keyword STAGO
SGML aspect "End Tag Open" keyword ETAGO
SGML aspect "Tag Close" keyword TAGC

In the SGML standard there is an initial basic SGML declaration given as
the "Concrete Reference Syntax" (CRS) and in the CRS you can find the
most common assignment of values for the example keywords I gave above
as follows...

STAGO <
ETAGO </
TAGC >

If you don't like those characters as the ones to use in your particular
application of SGML you are free to redefine the value assignments for
the keywords in your own home rolled SGML declaration e.g.

STAGO [+
ETAGO [-
TAGC ]

Under the CRS the following well known type of markup could be valid...

<SimPara>This is a simple paragraph.</SimPara>

...while under your own home rolled SGML declaration the following
markup could be valid...

[+SimPara]This is a simple paragraph.[-SimPara]

(note: there's a lot more to this than what meet the eye here, I'm only
giving a simple example of what an SGML declaration is used for)

One requirement in order to fully understand what SGML is and can be
used for is to learn about the defined meaning of all keywords in the
SGML standard and how they interact. Once you have that knowledge you
are ready to start the work on your own SGML application.
(not for any one with a heart condition sad to say :-)
--
Rex
Loading...