472,968 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Is it just 'bad form'?

I don't seem to see the following structure very often ...

<root>
<e1>this
<e2/>
<e3>that</e3>
</e1>
</root>

That is an element with text /and/ child nodes.

Is this just bad form? I know it is OK technically but are there
practical reasons for avoiding doing it?

--
Stuart
Tracers work both ways. - U.S. Army Ordnance

Jul 20 '05 #1
8 1448


DFN-CIS NetNews Service wrote:
I don't seem to see the following structure very often ...

<root>
<e1>this
<e2/>
<e3>that</e3>
</e1>
</root>

That is an element with text /and/ child nodes.

Is this just bad form? I know it is OK technically but are there
practical reasons for avoiding doing it?


Well, with a DTD suched mixed content is hard to restrict. Of course if
you look at XHTML container elements they need to allow such content but
even there the different document types make different restrictions, for
instance with the XHTML 1.0 transitional document type the <body>
element is defined as
<!ELEMENT body %Flow;>
where The Flow entity is defined as
<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
which is the mixed content of text and markup elements.
With the XHTML 1.0 strict document type <body> is defined as
<!ELEMENT body %Block;>
so there no mixed content is allowed, only block elements can be direct
children of the <body>.
With XHTML strict the reasons for that are that they want you to write
clean structured documents where you use proper container block elements
with the right semantics (for instance a <p> element) to wrap your text
content.
Thus looking at that you could say it is bad (but established form) to
have mixed content in every elements but a few selected ones.

As for your example if <e1> contains sentences in some human language
and <e2 /> is some empty element like an <img> element in XHTML and <e3>
is semantically necessary to mark up a part of a sentences contained in
<e1> then it is certainly not bad form but if <e1> contains different
data nodes then I would say that it is bad style to have some data in a
text node and some in element nodes.
--

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

Jul 20 '05 #2
On 20/01/2004, around 11:09, Martin Honnen wrote:

MH> Well, with a DTD suched mixed content is hard to restrict. Of course if
MH> you look at XHTML container elements they need to allow such
MH> content...
[deletia]

Interesting, thanks. In my case I'm talking about XML data rather than
XHTML, but that was useful.

TVM.

--
Stuart
Eat Healthy, Take Exercise, Die Anyway.

Jul 20 '05 #3
DFN-CIS NetNews Service wrote:
I don't seem to see the following structure very often ...

<root>
<e1>this
<e2/>
<e3>that</e3>
</e1>
</root>

That is an element with text /and/ child nodes.

Is this just bad form? I know it is OK technically but are there
practical reasons for avoiding doing it?

It rather depends on what you are using the XML for.
If it is "data-centric" , so being used to show the structure of some
data then it is probably bad form/ poorly designed ;
but if the use is "docu-centric" and so being used to show the mark up
and structure of a visible/readable document where one has a mix of
plain text , graphics and emphasis then it seems quite natural .
--
J. D. Addison

Jul 20 '05 #4
On 20/01/2004, around 11:33, Puff Addison wrote:

PA> If it is "data-centric" , so being used to show the structure of some
PA> data then it is probably bad form/ poorly designed ;
That's precisely it; it /feels/ bad but I can't get a handle on why we
shouldn't be doing it.

I'd rather see something like

<root>
<e1>
<e1_text>this</e1_text>
<e2/>
<e3>that</e3>
</e1>
</root>

IYSWIM.

--
Stuart
If at first you don't succeed, skydiving is not for you.

Jul 20 '05 #5
DFN-CIS NetNews Service wrote:
On 20/01/2004, around 11:33, Puff Addison wrote:

PA> If it is "data-centric" , so being used to show the structure of some
PA> data then it is probably bad form/ poorly designed ;
That's precisely it; it /feels/ bad but I can't get a handle on why we
shouldn't be doing it.

I'd rather see something like

<root>
<e1>
<e1_text>this</e1_text>
<e2/>
<e3>that</e3>
</e1>
</root>

IYSWIM.


Yes. I see what you mean.
If you are creating the mark up then you are free do it that way. But it
is not clear to me that you get any real benefit
unless e1_text is to have some structure of its own but you do add to
the overhead of document creation.
Think of paragraph a number of words or phrases in bold or italic or
courier. Every time I need to add a new e1_text element as well.

--
J. D. Addison

Jul 20 '05 #6
On Tue, 20 Jan 2004 10:29:49 +0000, DFN-CIS NetNews Service
<sh******@estatecomputers.com> wrote:
I don't seem to see the following structure very often ...


I see it a lot, and a damn nuisance it is too.

What are you storing here ? An XML tree structure of "data items",
with leaf nodes that contain a string ? Or a text document, with
embedded markup ?

If it's the first, then avoid this as far as you can. It causes all
sorts of trouble.

If it's the second (which includes (X)HTML) then it's hard to avoid
it. It's possible to avoid it, but only by making the DTD
significantly more complex, to an impractical degree. In the DocBook
world it's known as "pernicious mixed content" and is subject to much
debate.

--
#1A1A1A is the new black
Jul 20 '05 #7
Andy Dingley wrote:
On Tue, 20 Jan 2004 10:29:49 +0000, DFN-CIS NetNews Service
<sh******@estatecomputers.com> wrote:

I don't seem to see the following structure very often ...

I see it a lot, and a damn nuisance it is too.

What are you storing here ? An XML tree structure of "data items",
with leaf nodes that contain a string ? Or a text document, with
embedded markup ?

If it's the first, then avoid this as far as you can. It causes all
sorts of trouble.

If it's the second (which includes (X)HTML) then it's hard to avoid
it. It's possible to avoid it, but only by making the DTD
significantly more complex, to an impractical degree. In the DocBook
world it's known as "pernicious mixed content" and is subject to much
debate.


Pernicious mixed content only exists in SGML, not XML.

///Peter

Jul 20 '05 #8
On Wed, 21 Jan 2004 01:26:41 +0000, Peter Flynn <pe***@silmaril.ie>
wrote:
Pernicious mixed content only exists in SGML, not XML.


Sorry - I should have been clearer.

DocBook is an SGML standard that moved to XML (is it the only major
standard that did this ?). When it was in SGML, then pernicious mixed
content was a real problem. It's still worth reading up on, because
the problem is still there, just watered down. "Pernicious mixed
content" is a more useful search term than "mixed content" for
finding it.

Jul 20 '05 #9

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

Similar topics

7
by: Heath | last post by:
I was reading that it is considered bad form to require a browser to redraw the page after it has been loaded, ie image swaps or color changes using the pseudo-class a:active or a:hover, is is this...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
10
by: cppaddict | last post by:
Hi, I am writing a program and needs to know one of its object members before it can be initialized. It doesn't really matter for my question (which a C++ question, not a windows question), but...
4
by: Bob | last post by:
#include <vector> #include <cstring> namespace { void bad() { std::vector<bool> v(0); v.push_back(true); v.push_back(false);
2
by: Adam Smith | last post by:
Syntax problem Link works w/ Netscape <a href="passwdhlp.html"> <button type="button" name="Help" style="font: 11pt arial bold; background white;color:red">Help!</button> </a> But not...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
2
by: Jeff | last post by:
raggle fraggle and so on Why does this happen? I had just entered some code and when I saved the form, through the menu option, Access nicely shutdown and lost the changes. I know, I should save...
2
by: JThomas | last post by:
Hello! I'm having trouble with a page apparently causing my client's Safari browser to time out. I don't actually have access to a Mac & Safari, and haven't been able to physically see this...
7
by: Tom van Stiphout | last post by:
A client has about 15 workstations, all running an Access 2000 application we wrote for him. Three WinXP workstations have a problem you can see here:...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.