[clug] Server-side scripting - Content model, flow content

jhock jhock at iinet.net.au
Thu Jan 17 04:53:56 UTC 2019


On Thu, 2019-01-17 at 06:26 +1100, George at Clug via linux wrote:
> Below are several links regarding the address element. I still
> cannot determine whether it is permissible to use Tables within an
> address element, and I would have to study "flow content", "Content
> model", etc a lot more to understand the meaning and how these terms
> are used.
> 
> 
> 
> 
> http://jkorpela.fi/html/address.html
> Using the address element
> 
> It seems very natural to use the address element for an address. But
> according to the definition of the address element (in the HTML
> specification), the element contains contact information for the
> author of the document where it appears, or the author of a part of
> the document.
> 
> In theory at least, someone who is specifically looking for contact
> information about documents might have a user style sheet that
> strongly highlights address elements, or a robot that specifically
> searches for them. Of course, since address element is not very
> widely
> used for its defined purpose, and since it is sometimes used
> incorrectly for addresses in general, such methods are not highly
> successful, but perhaps not completely pointless either.
> 
> Using a table
> 
> There's yet another option for presenting an address in markup: a
> table. After all, the address consists of logical units (typically
> rendered each on one line), which might have headers attached to
> them,
> such as “Name”, “Street address”, etc. It looks pretty much
> like a data table, with the headers as th cells, actual data in td
> cells, and perhaps with a caption that says what the address is for,
> or something. Now if you omit the caption and imply the headers, does
> it stop being a table?
> 
> This means markup like the following:
> 
> 
> 
> 
> 
> 		Jukka K. Korpela
> 
> 
> 
> 		Päivänsäteenkuja 4 asunto 1
> 
> 
> 
> 		02210 Espoo
> 
> 
> 
> 
> 
> 
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address
> Permitted content     Flow content, but with no nested  element, no
> heading content (, , , , , , ), no sectioning content (, , , ), and
> no
>  or  element.
> 
> 
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
> Permitted parents     Any element that accepts flow content
> 
> https://jats.nlm.nih.gov/archiving/tag-library/1.1d1/n-mp20.html
> Address/Contact Information
> Container element for contact information such as a postal address
> for
> a person or organization.
> 
> This element may be contained in:
> , , , , , , , , , , , , 
> 	* , , , , , , , 
> 
> 
> https://jats.nlm.nih.gov/archiving/tag-library/1.1/element/table.html
> 
> 
> 
> =====================================================================
> =
> 
> https://stackoverflow.com/questions/27042119/correct-usage-of-html5-address-element
> 
> 
> In your use-case, it probably is incorrect usage.
> 
> As per the official refs:
> 
>     The address element must not be used to represent arbitrary
> addresses (e.g. postal addresses), unless those addresses are in fact
> the relevant contact information. (The p element is the appropriate
> element for marking up postal addresses in general.)
> 
> Ref, Living standard:
> https://html.spec.whatwg.org/multipage/semantics.html#the-address-element
> 
> Ref, Spec HTML4.01:
> http://www.w3.org/TR/html401/struct/global.html#h-7.5.6
> 
> Ref, Recomendation HTML5:
> http://www.w3.org/TR/html5/sections.html#the-address-element
> 
> .
> 
> You are presenting several postal addresses, and so it seems a p is
> more appropriate here. Regarding address, it represents contact
> information for its nearest article or body and is also allowed in
> footer.
> 
> 
> Please use references that are not w3schools; it often contains
> inaccuracies. The MDN and the HTML5 recommendation on w3.org are
> excellent references. – misterManSam Nov 20 '14 at 14:44
> 
> 
> https://www.w3.org/TR/html5/grouping-content.html#elementdef-address
> 
> https://html.spec.whatwg.org/multipage/sections.html
> 
> https://html.spec.whatwg.org/multipage/sections.html#the-address-element
> 
> 
> https://html.spec.whatwg.org/multipage/dom.html#concept-element-content-model
> Content model
>     A normative description of what content must be included as
> children and descendants of the element.
> 
> https://www.w3.org/TR/html5/grouping-content.html#elementdef-address
> 4.4.2. The address element
> Content model:
>     Flow content, but with no heading content descendants, no
> sectioning content descendants, and no header, footer, or address
> element descendants. 
> 
> 
> https://jats.nlm.nih.gov/archiving/tag-library/1.1d1/n-mp20.html
> 
> 
> 
> =====================================================================
> ===================
> 
> https://mailchimp.com/help/common-html-mistakes/

Hi George,


According to the DTD at URL: 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd the address
element has the following content:

<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
<!ATTLIST address
  %attrs;

Ignoring the attributes, because you want to know if the address
element can have table elements, address can be either:

#PCDATA which is just text

%inline

<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; |
%inline.forms;">

These values are just content:

<!ENTITY % special.extra
   "object | applet | img | map | iframe">
        
<!ENTITY % special.basic
        "br | span | bdo">

<!ENTITY % special
   "%special.basic; | %special.extra;">

Fontstyle is:

<!ENTITY % fontstyle.extra "big | small | font | basefont">

<!ENTITY % fontstyle.basic "tt | i | b | u
                      | s | strike ">

<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">

Phrase is:
<!ENTITY % phrase.extra "sub | sup">
<!ENTITY % phrase.basic "em | strong | dfn | code | q |
                   samp | kbd | var | cite | abbr | acronym">

<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">

and inline.forms are:

<!ENTITY % inline.forms "input | select | textarea | label | button">


There appears to be nothing there that allows the table element
although it's a very long time since I've read DTDs and I may be
missing something.

I hope that this helps.

John.





More information about the linux mailing list