XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Quiz: is this XML well-formed?

Actually, the space character is *not* required by SGML.

From ISO 8879:

"The leading [space] can only be omitted from an attribute specification
  that follows a delimiter" (clause 7.9)

meaning that spaces are optional as long as the attribute value
literal is enclosed in single or double quotes; which, in SGML (and
HTML), they don't have to be as long as the attribute value

"contains nothing but name characters and either [it's declared] or
[SHORTTAG YES is effective]." (clause 7.9.3.1)

Try it out yourself, using either osgmlnorm (OpenSP) or sgmlproc (sgmljs.net):

    $ cat test.sgm
    <!DOCTYPE test [
      <!ELEMENT test - - ANY>
      <!ATTLIST test
        att CDATA #IMPLIED
        otheratt CDATA #IMPLIED>
    ]>
    <test att="x"otheratt="y"></test>

    $ osgmlnorm test.sgm
    <TEST ATT="x" OTHERATT="y"></TEST>

    $ sgmlproc test.sgm
    <!DOCTYPE test [
      <!ELEMENT test - - ANY>
      <!ATTLIST test
        att CDATA #IMPLIED
	otheratt CDATA #IMPLIED>
    ]>
    <test att="x" otheratt="y"></test>

So, once again, XML heads can't blame it on SGML :)

Best,
M. Reichardt
sgmljs.net

On 2/4/21, Liam R. E. Quin <liam@fromoldbooks.org> wrote:
> On Thu, 2021-02-04 at 18:18 +0000, Roger L Costello wrote:
>> But, but, but, ... Why is space required between attributes? Surely a
>> parser can recognize the start of the next attribute given the end-
>> delimiter of the previous attribute's value, yes?
>
> In SGML the rules for attributes were (are) much more complex, because
> of minimization. At SoftQuad, minimization and related features
> represented approximately 80% of our support costs for Author/Editor
> (an SGML editor).
>
> I won't say you couldn't set up an SGML declaration to permit those
> spaces to be elided, but they were generally needed because in SGML the
> quotation marks were optional if the attribute value was declared as a
> list,
> <!ATTLIST boy
>   socks (grey|grubby|torn|lost) #REQUIRED
>   weapon (conker|plushie|manupulative-cry|none) "none"
>>
>
> let you write <boy grey plushie>...
>
> Note it's the attribute names that can be omitted, so that e.g. in
> HTML, strictly speaking when you write <table border>you are not
> setting an attribute called border, you are supplying the value of
> border and the parser has to determine to which attribute it belongs
> (in practice you are setting border="border"). Unfortnately,
> implementers of HTML didn't have access to the actual SGML spec (i sent
> a copy of the SGML Handbook to one of them!) because at ₤300 or more,
> it was well over the budget of a graduate student, so they guessed, and
> it looked like <table border> was the same as <table border="true">, so
> that's more like how HTML works. But XML came out of SGML.
>
> Now, as Ken pointed out, we wanted every valid XML document to be an
> SGML document. After a huge fight, in the end, SGML was actually
> modified to make this possible, and if we had not had the fight but had
> been able to work together, we could have made a number of decisions
> differently; wanting asymmetric comment tokens was another for example,
> where i'd proposed <!--* .... *--> for comments. <!- ... -> would have
> beeen possible too, if SGML could have been modified to allow it.
>
> But above all else we wanted a language easy to process and parse - the
> "desperate Perl hacker" should be able to change all occurrences of
> 2021 in a part number without affecting dates. So we required the full
> attribute="value" with no minimization, but didn't revisit the space
> there.
>
> It is not, i think, too onerous - a space is in any case needed after
> the element name even though <boytornconker> might not be ambiguous in
> a given DTD, but it can be difficult for a human to determine this.
>
> Liam
>
>
> --
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
>
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS