Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Why is XML "stupid" about element ordering?

Reply
Thread Tools

Why is XML "stupid" about element ordering?

 
 
Arturius mac Aidan
Guest
Posts: n/a
 
      10-30-2005
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.
--
..
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      10-30-2005
In article <(E-Mail Removed)>,
Arturius mac Aidan <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Arturius mac Aidan
Guest
Posts: n/a
 
      10-30-2005
Richard Tobin wrote:

> In article <(E-Mail Removed)>,
> Arturius mac Aidan <(E-Mail Removed)> 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.
--
..
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      10-30-2005
In article <(E-Mail Removed)>,
Arturius mac Aidan <(E-Mail Removed)> 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
 
Reply With Quote
 
Arturius mac Aidan
Guest
Posts: n/a
 
      10-31-2005
Richard Tobin wrote:

> In article <(E-Mail Removed)>,
> Arturius mac Aidan <(E-Mail Removed)> 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.

--
..
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      10-31-2005
Arturius mac Aidan wrote:

> Richard Tobin wrote:
>
>> In article <(E-Mail Removed)>,
>> Arturius mac Aidan <(E-Mail Removed)> 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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Problem to insert an XML-element by XSLT-converting from one XML-file into another XML-file jkflens XML 2 05-30-2006 09:41 AM
XML TRANSFORM - Serious problem - nested element causes Index error...why oh why??? KathyB ASP .Net 0 06-24-2003 07:37 PM



Advertisments