Why is XML "stupid" about element ordering?

Discussion in 'XML' started by Arturius mac Aidan, Oct 30, 2005.

  1. 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.
    --
    ..
     
    Arturius mac Aidan, Oct 30, 2005
    #1
    1. Advertising

  2. In article <>,
    Arturius mac Aidan <> 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
     
    Richard Tobin, Oct 30, 2005
    #2
    1. Advertising

  3. Richard Tobin wrote:

    > In article <>,
    > Arturius mac Aidan <> 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.
    --
    ..
     
    Arturius mac Aidan, Oct 30, 2005
    #3
  4. In article <>,
    Arturius mac Aidan <> 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
     
    Richard Tobin, Oct 30, 2005
    #4
  5. Richard Tobin wrote:

    > In article <>,
    > Arturius mac Aidan <> 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.

    --
    ..
     
    Arturius mac Aidan, Oct 31, 2005
    #5
  6. Arturius mac Aidan

    Peter Flynn Guest

    Arturius mac Aidan wrote:

    > Richard Tobin wrote:
    >
    >> In article <>,
    >> Arturius mac Aidan <> 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/
     
    Peter Flynn, Oct 31, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,128
    Smokey Grindel
    Dec 2, 2006
  2. nbigaouette

    Z-Ordering (Morton ordering) question

    nbigaouette, Nov 5, 2009, in forum: C Programming
    Replies:
    2
    Views:
    2,273
  3. Florian Lindner

    XML parser: Element ordering?

    Florian Lindner, Aug 31, 2012, in forum: Python
    Replies:
    0
    Views:
    183
    Florian Lindner
    Aug 31, 2012
  4. Stefan Behnel

    Re: XML parser: Element ordering?

    Stefan Behnel, Aug 31, 2012, in forum: Python
    Replies:
    0
    Views:
    196
    Stefan Behnel
    Aug 31, 2012
  5. Dave Angel

    Re: XML parser: Element ordering?

    Dave Angel, Aug 31, 2012, in forum: Python
    Replies:
    0
    Views:
    225
    Dave Angel
    Aug 31, 2012
Loading...

Share This Page