473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

xhtml <body> w/ text() nodes-- why?

I have a question regarding xhtml. Why, why, why does the ELEMENT <body>
allow “unblocked” text. HTML does not (though, most browsers will
render). Xhtml (transitional) however allows text nodes (PCDATA).

All of HTML 4, xhtml – transitional, and xhtml-strict allow <div> to
contain “unblocked” text. Does anybody know why – I’m looking for the
philosophy behind allowing such.

I’m in the process of encapsulating xhtml mark-up in content marked xml.
The content mark-up describes technical “facts” – the descriptions are
encapsulations of “ideas” expressed in English. Those encapsulations use
most of the exposition tools available to authors: tables, images, …
most all things allowed in xhtml. Now, for a variety of reasons I do not
want text fragments just hanging – they need to be part of a paragraph
(<p>), a list, a table… Until I started on this project I never paid
close attention to the formal dtds defining xhtml/html variants – I just
always thought “unblocked text” was not allowed. If it were not, I would
be able to simply adopt large portions of those dtds in my dtd (and
easily convert existing html and portions thereof into my compendiums of
xml “wrappered” facts.

I’m hoping that if I could understand the reasoning rational for
allowing “unblocked” text in a div (or, on the extreme case in body), I
might see that I should not be worried about the same in my application.

Thanks for any insight you can supply.
Gordon
Jul 20 '05 #1
1 2096


Gordon - Adelphia wrote:
I have a question regarding xhtml. Why, why, why does the ELEMENT <body>
allow “unblocked” text. HTML does not (though, most browsers will
render). Xhtml (transitional) however allows text nodes (PCDATA).

All of HTML 4, xhtml – transitional, and xhtml-strict allow <div> to
contain “unblocked” text. Does anybody know why – I’m looking for the
philosophy behind allowing such.


Looking at the HTML 4.01 transitional DTD at
http://www.w3.org/TR/html4/sgml/loosedtd.html
the BODY element is defined as
<!ELEMENT BODY O O (%flow;)* +(INS|DEL) -- document body -->
where flow is defined as
<!ENTITY % flow "%block; | %inline;">
and inline is defined as
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; |
%formctrl;">
thus I think that with HTML 4.01 transitional it is valid to have text
nodes as child nodes of the BODY element. An example is at
http://home.arcor.de/martin.honnen/j...004060501.html
it validates with http://validator.w3.org:
http://validator.w3.org/check?uri=ht...ss=1&verbose=1

Looking at the HTML 4.01 strict DTD at
http://www.w3.org/TR/html4/sgml/dtd.html
the BODY element is defined as
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
thus with HTML 4.01 strict text nodes are not allowed as direct child
nodes of the BODY element.

Now looking at the definitions in XHTML 1.0 transitional at
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
the body element is defined as
<!ELEMENT body %Flow;>
and Flow is defined as
<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
while in XHTML 1.0 strict the body element is defined as
<!ELEMENT body %Block;>

I don't see where XHTML 1.0 transitional differs from HTML 4.01
transitional in regards to text nodes as direct child nodes of the body
element, both allow. Furthermore both XHTML 1.0 strict as well as HTML
4.01 strict both disallow text nodes as direct child nodes of the body
element.
Thus I don't see the problem with body you have outlined above.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andy Fish | last post by:
in XSLT, if I want to concatenate _all_ the child text nodes, I can just do <xsl:value-of select="."> however, if I want to select and concatente only _some_ of the text nodes. for instance ...
8
by: Xamle Eng | last post by:
One of the things I find most unnatural about most XML APIs is that they try to abstract both elements and text into some kind of "node" object when they have virtually nothing in common. The...
2
by: RobG | last post by:
Why does Firefox insert #text nodes as children of TR elements? As a work-around for older Safari versions not properly supporting a table row's cells collection, I used the row's childNodes...
1
by: Jeremy | last post by:
I have a script that runs a regular expression replace on all text in the document. Currently, I recurse the entire document looking for text nodes and run the replacement on the text nodes when I...
2
by: Andreas W. Wylach | last post by:
Hi everybody, I am about implementing a little search engine that searches a phrase over xml text nodes. I got that all working fine but what I want as the results is not the complete text of...
6
by: avsyam | last post by:
Hi, I want to select all the text nodes of an xml document using msxml dom. I tried using the selectNodes method with "//#text" argument. But it fails. Can anybody help please? Thank you.
2
by: Mike | last post by:
If you have the following xhtml fragment <div> Some text </div> This will be an element with innerText of "Some text". But in the case of <div> Some text
0
by: Water Cooler v2 | last post by:
Can someone please explain this section of this tutorial me? http://www.w3schools.com/dom/dom_mozilla_vs_ie.asp The relevant text I do not understand is: "Internet Explorer, when using...
14
by: Mikhail Teterin | last post by:
Hello! What's would be the syntax for a query, which would allow me to get only the elements with non-empty text-nodes? For example, from: <a><b></b></a> <c/> <d><e>meow</e></d>
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.