Invalid XML

Discussion in 'XML' started by Esther, Aug 31, 2004.

  1. Esther

    Esther Guest

    I'm pretty new to XML/XSLT, although not to development. I had thought
    that one of the premises of XML is that every tag requires a closing
    tag.

    I've just been handed a spec prepared by one of our vendors that
    includes instructions and samples like these:

    "<difficulty_section> Tag

    This tag defines a difficulty level that will be used for all
    subsequent questions. This difficulty level will be used until a new
    <difficulty_section> tag is found, or until a </difficulty_section>
    end tag clears the level.

    Example:

    <difficulty_section>
    Advanced

    <difficulty_section>
    Beginner"

    I wasn't aware this was possible, especially since nesting is allowed
    in their model. Could someone please clarify for me if I'm missing one
    of the finer points of XML, or are these people just idiots?
    Esther, Aug 31, 2004
    #1
    1. Advertising

  2. Esther

    jmm-list-gn Guest

    Esther wrote:
    > I've just been handed a spec prepared by one of our vendors that
    > includes instructions and samples like these:
    >
    > "<difficulty_section> Tag
    >
    > I wasn't aware this was possible, especially since nesting is allowed
    > in their model. Could someone please clarify for me if I'm missing one
    > of the finer points of XML, or are these people just idiots?
    >

    It certainly not valid XML. It is not even well-formed. This does not
    mean a parser cannot parse the document; only that the document is poorly
    created.
    XML is similar to HTML in this respect. A lot of very bad HTML markup
    can be rendered (more or less) as expected; bad markup makes the browser
    work harder and reduces the chances that the result is the same for all
    browsers.
    So they are not idiots, exactly. They just don't bother with validation.

    --
    jmm dash list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
    jmm-list-gn, Aug 31, 2004
    #2
    1. Advertising

  3. Esther

    Andy Dingley Guest

    On 31 Aug 2004 12:52:28 -0700, (Esther) wrote:

    >Could someone please clarify for me if I'm missing one
    >of the finer points of XML, or are these people just idiots?


    Hard to tell. Is this even XML ? If they're using SGML, then they
    _might_ get away with this.

    I'm loath to call them idiots (we haven't even been introduced, after
    all) but the worst part of this IMHO is their (all too common)
    treatment of an _example_ as a _specification_. This is just a very
    bad idea - examples only describe one single instance, not the whole
    problem domain. It's a good route to all sorts of obscure future
    problem, and a particular bugbear of mine.

    If you're specifiying the format of an XML document, use either a DTD
    or (better) a schema. If you can't do either, or don;t know why you
    ought to, then you might not be an idiot but you're certainly out of
    your depth.

    --
    Smert' spamionam
    Andy Dingley, Sep 1, 2004
    #3
  4. In article <>,
    jmm-list-gn <> wrote:
    % Esther wrote:
    % > I've just been handed a spec prepared by one of our vendors that
    % > includes instructions and samples like these:
    % >
    % > "<difficulty_section> Tag
    % >
    % > I wasn't aware this was possible, especially since nesting is allowed
    % > in their model. Could someone please clarify for me if I'm missing one
    % > of the finer points of XML, or are these people just idiots?
    % >
    % It certainly not valid XML. It is not even well-formed. This does not
    % mean a parser cannot parse the document; only that the document is poorly
    % created.

    Conforming XML parsers are required to stop passing parsing information
    to the application when they encounter well-formedness errors. The
    reason for this is to prevent the problem with HTML, which is that
    everyone has to be able to process garbage documents in order to
    inter-operate with everyone else.

    % So they are not idiots, exactly. They just don't bother with validation.

    It seems like they didn't bother using XML at all. To the OP, is this
    supposed to be XML, or is it SGML? The kind of mark-up you describe is
    quite common and perfectly legal in the SGML world.
    --

    Patrick TJ McPhee
    East York Canada
    Patrick TJ McPhee, Sep 1, 2004
    #4
  5. Esther

    Esther Guest

    Andy Dingley <> wrote in message news:<>...
    > On 31 Aug 2004 12:52:28 -0700, (Esther) wrote:
    >
    > >Could someone please clarify for me if I'm missing one
    > >of the finer points of XML, or are these people just idiots?

    >
    > Hard to tell. Is this even XML ? If they're using SGML, then they
    > _might_ get away with this.


    Nope, it's supposed to be XML.

    >
    > I'm loath to call them idiots (we haven't even been introduced, after
    > all) but the worst part of this IMHO is their (all too common)
    > treatment of an _example_ as a _specification_. This is just a very
    > bad idea - examples only describe one single instance, not the whole
    > problem domain. It's a good route to all sorts of obscure future
    > problem, and a particular bugbear of mine.


    I *have* been introduced, and it would not be the most inaccurate
    name...

    >
    > If you're specifiying the format of an XML document, use either a DTD
    > or (better) a schema. If you can't do either, or don;t know why you
    > ought to, then you might not be an idiot but you're certainly out of
    > your depth.


    I know why you should use DTD/schema, but as I said - I'm new to this
    and hesitated to call them on it because I wasn't positive there
    wasn't some advanced concept I was missing that would allow it.

    Thanks all of you for your answers.
    Esther, Sep 1, 2004
    #5
  6. Patrick TJ McPhee () wrote:
    : In article <>,
    : jmm-list-gn <> wrote:
    : % Esther wrote:
    : % > I've just been handed a spec prepared by one of our vendors that
    : % > includes instructions and samples like these:
    : % >
    : % > "<difficulty_section> Tag
    : % >
    : % > I wasn't aware this was possible, especially since nesting is allowed
    : % > in their model. Could someone please clarify for me if I'm missing one
    : % > of the finer points of XML, or are these people just idiots?
    : % >
    : % It certainly not valid XML. It is not even well-formed. This does not
    : % mean a parser cannot parse the document; only that the document is poorly
    : % created.

    : Conforming XML parsers are required to stop passing parsing information
    : to the application when they encounter well-formedness errors.

    The problem is not a well-formedness error though, so a SAX parser could
    parse past the tags, the error would not occur until later when the
    balancing didn't work.
    Malcolm Dew-Jones, Sep 1, 2004
    #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. Patrick.O.Ige
    Replies:
    1
    Views:
    1,934
    Patrick.O.Ige
    Jul 2, 2006
  2. Java Guy
    Replies:
    1
    Views:
    661
    Manish Pandit
    Oct 15, 2006
  3. kevin
    Replies:
    0
    Views:
    944
    kevin
    Jan 16, 2008
  4. Stefan Behnel
    Replies:
    0
    Views:
    752
    Stefan Behnel
    May 4, 2010
  5. Java Guy
    Replies:
    1
    Views:
    284
Loading...

Share This Page