[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Quiz: is this XML well-formed?

  • From: Marcus Reichardt <u123724@gmail.com>
  • To: "Liam R. E. Quin" <liam@fromoldbooks.org>
  • Date: Thu, 4 Feb 2021 21:45:26 +0100

Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.