Invalid XML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Esther

    Invalid XML

    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_se ction> 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_sec tion> tag is found, or until a </difficulty_sect ion>
    end tag clears the level.

    Example:

    <difficulty_sec tion>
    Advanced

    <difficulty_sec tion>
    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?
  • jmm-list-gn

    #2
    Re: Invalid XML

    Esther wrote:[color=blue]
    > I've just been handed a spec prepared by one of our vendors that
    > includes instructions and samples like these:
    >
    > "<difficulty_se ction> 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?
    >[/color]
    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)

    Comment

    • Andy Dingley

      #3
      Re: Invalid XML

      On 31 Aug 2004 12:52:28 -0700, esthermstrom@ya hoo.com (Esther) wrote:
      [color=blue]
      >Could someone please clarify for me if I'm missing one
      >of the finer points of XML, or are these people just idiots?[/color]

      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

      Comment

      • Patrick TJ McPhee

        #4
        Re: Invalid XML

        In article <_sqdne8dXo63cq ncRVn-hw@giganews.com >,
        jmm-list-gn <jmm-list.AXSPAMGN@s ohnen-moe.com> wrote:
        % Esther wrote:
        % > I've just been handed a spec prepared by one of our vendors that
        % > includes instructions and samples like these:
        % >
        % > "<difficulty_se ction> 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
        ptjm@interlog.c om

        Comment

        • Esther

          #5
          Re: Invalid XML

          Andy Dingley <dingbat@codesm iths.com> wrote in message news:<gn4aj0966 f2ver9g2njdqge6 b3a4frohvh@4ax. com>...[color=blue]
          > On 31 Aug 2004 12:52:28 -0700, esthermstrom@ya hoo.com (Esther) wrote:
          >[color=green]
          > >Could someone please clarify for me if I'm missing one
          > >of the finer points of XML, or are these people just idiots?[/color]
          >
          > Hard to tell. Is this even XML ? If they're using SGML, then they
          > _might_ get away with this.[/color]

          Nope, it's supposed to be XML.
          [color=blue]
          >
          > 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.[/color]

          I *have* been introduced, and it would not be the most inaccurate
          name...
          [color=blue]
          >
          > 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.[/color]

          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.

          Comment

          • Malcolm Dew-Jones

            #6
            Re: Invalid XML

            Patrick TJ McPhee (ptjm@interlog. com) wrote:
            : In article <_sqdne8dXo63cq ncRVn-hw@giganews.com >,
            : jmm-list-gn <jmm-list.AXSPAMGN@s ohnen-moe.com> wrote:
            : % Esther wrote:
            : % > I've just been handed a spec prepared by one of our vendors that
            : % > includes instructions and samples like these:
            : % >
            : % > "<difficulty_se ction> 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.

            Comment

            Working...