469,931 Members | 1,831 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,931 developers. It's quick & easy.

Why is XML "stupid" about element ordering?

I'm not sure if this has been addressed in more recent developments, but I'm
reading the MathML specification which states "For example, it is not
possible in XML to specify that the first child be interpreted one way, and
the second in another." Is there a compelling reason that XML does not
support that capability? Has it been fixed?

I recall attempting to create my own schemas a couple years ago, and finding
this limitation. For my purposes it was significant.
--
..
Oct 30 '05 #1
5 1494
In article <mL********************@speakeasy.net>,
Arturius mac Aidan <ab*****@waters.loch> wrote:
I'm not sure if this has been addressed in more recent developments, but I'm
reading the MathML specification which states "For example, it is not
possible in XML to specify that the first child be interpreted one way, and
the second in another."
Since XML doesn't specify how elements are interpreted, this doesn't
make much sense. Applications can interpret XML any way they want to.
I recall attempting to create my own schemas a couple years ago, and finding
this limitation.


Now you are talking about schemas, which constrain XML and perhaps
assign types to it, rather than interpret it. It's true that you
can't use XML Schemas to specify different constraints on children of
an element with the same name, but there are all kinds of constraints
that you can't express.

-- Richard
Oct 30 '05 #2
Richard Tobin wrote:
In article <mL********************@speakeasy.net>,
Arturius mac Aidan <ab*****@waters.loch> wrote:
I'm not sure if this has been addressed in more recent developments, but
I'm reading the MathML specification which states "For example, it is not
possible in XML to specify that the first child be interpreted one way,
and the second in another."


Since XML doesn't specify how elements are interpreted, this doesn't
make much sense. Applications can interpret XML any way they want to.


I was quoting the W3C's MathML2 Recommendation. There are rules which
determine how a noun should be interpreted based on its location in a
sentence or phrase. Those are rules of grammar. I'm going to have to give
this more thought before I can provide a concrete example of what I had
expected to work. As I say, it's been a couple years, and I have not been
working with XML much in the interim. I do know I was frustrated by the
inability to constrain attributes according the the context of the element
where they appeared.
I recall attempting to create my own schemas a couple years ago, and
finding this limitation.


Now you are talking about schemas, which constrain XML and perhaps
assign types to it, rather than interpret it. It's true that you
can't use XML Schemas to specify different constraints on children of
an element with the same name, but there are all kinds of constraints
that you can't express.


This is taken directly from the XML 1.0, 3rd edition:

"Definition: The XML document type declaration contains or points to markup
declarations that provide a grammar for a class of documents. This grammar
is known as a document type definition, or DTD. The document type
declaration can point to an external subset (a special kind of external
entity) containing markup declarations, or can contain the markup
declarations directly in an internal subset, or can do both. The DTD for a
document consists of both subsets taken together."

I would argue that the use of DTDs is defined in the XML Recommendation.
That definition may leave some room for extension within the framework of
XML, but XML DTDs are not autonomous structures. The are required to
conform to several requirements stated by the XML Recommendation.
--
..
Oct 30 '05 #3
In article <s_********************@speakeasy.net>,
Arturius mac Aidan <ab*****@waters.loch> wrote:
I recall attempting to create my own schemas a couple years ago, and
finding this limitation.
Now you are talking about schemas, which constrain XML and perhaps
assign types to it, rather than interpret it. It's true that you
can't use XML Schemas to specify different constraints on children of
an element with the same name, but there are all kinds of constraints
that you can't express.
This is taken directly from the XML 1.0, 3rd edition:


Ok, I was taking schemas to mean XML Schemas, but the point is the
same: DTDs allow you to place constraints on a document; they don't
restrict how you can interpret the document. You are quite at liberty
to have the one <foo> element mean something quite different from
another.

-- Richard
Oct 30 '05 #4
Richard Tobin wrote:
In article <s_********************@speakeasy.net>,
Arturius mac Aidan <ab*****@waters.loch> wrote:
I recall attempting to create my own schemas a couple years ago, and
finding this limitation. Now you are talking about schemas, which constrain XML and perhaps
assign types to it, rather than interpret it. It's true that you
can't use XML Schemas to specify different constraints on children of
an element with the same name, but there are all kinds of constraints
that you can't express.
This is taken directly from the XML 1.0, 3rd edition:


Ok, I was taking schemas to mean XML Schemas,


Had I not looked at the XML Recommendation for clarification, I would not
take issue with your drawing a distinction; however, in view of the useage
by the W3C, I believe "DTD" is intended to be inclusive of all XML grammar
definitions. That is, XSD definitions are DTDs in the sense that they
define a document type.
but the point is the
same: DTDs allow you to place constraints on a document; they don't
restrict how you can interpret the document. You are quite at liberty
to have the one <foo> element mean something quite different from
another.


Yes, but sometimes syntax and semantics are interrelated. I am not able to
dedicate the time to formulating a compelling example right now. I have
literally thousands of pages of technical material to cover in a short
period. I can offer the example of natural languages, and in particular,
the grammatically degenerate English language which relies heavily on
syntax to convey semantic interpretations. In an English sentence, the set
of words (and word-forms) which are permitted to immediately follow a noun
is determined by the role that noun plays in a sentence. So, for example,
if I have element definitions for parts of speech such as <noun/> <verb/>
<adverb/>, etc., the list of permissible tags allowed by the rules of
English grammar is determined by what precedes it in a sentence.

I do not believe XML DTDs (inclusive) are capable of codifying English
grammar in this sense. I'm not saying they should be. That's why I
suggested the example given is less than compelling.

--
..
Oct 31 '05 #5
Arturius mac Aidan wrote:
Richard Tobin wrote:
In article <mL********************@speakeasy.net>,
Arturius mac Aidan <ab*****@waters.loch> wrote:
I'm not sure if this has been addressed in more recent developments,
but I'm reading the MathML specification which states "For example,
it is not possible in XML to specify that the first child be
interpreted one way, and the second in another."


Since XML doesn't specify how elements are interpreted, this doesn't
make much sense. Applications can interpret XML any way they want
to.


I was quoting the W3C's MathML2 Recommendation. There are rules which
determine how a noun should be interpreted based on its location in a
sentence or phrase. Those are rules of grammar. I'm going to have to
give this more thought before I can provide a concrete example of what
I had expected to work.


That would be useful, as I find it hard to imagine what you expect.
Are you implying that in the sentence

<para><productname>Word</productname> is like
<productname>WordPerfect</productname>.</para>

the first productname element should be treated differently to the
second?

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Oct 31 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Jordan Rastrick | last post: by
17 posts views Thread by Torbjørn Pettersen | last post: by
32 posts views Thread by Will Hartung | last post: by
388 posts views Thread by maniac | last post: by
6 posts views Thread by Adam Smith | last post: by
9 posts views Thread by Klaus Johannes Rusch | last post: by
19 posts views Thread by maya | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.