XML Spec CharData doubt

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

    #1

    XML Spec CharData doubt

    Hi All,

    I have a doubt in "CharData" grammar given XML 1.0 spec (http://
    www.w3.org/TR/REC-xml/#NT-CharData).

    [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

    The text above [14] (in spec) describing CharData says that char data
    must not have following chars: ^,<,& and it must not have ']]>' (CDATA
    ending section) inside it. The grammar is given above. I was wondering
    if the grammar can be written as

    CharData ::= [^<&]* - ']]>'

    Wouldnt this mean the same thing as the text describing [14]?

    Thanks in advance,
    Manish

    PS: I am sorry if the message doesn't fit in this group.

  • Bjoern Hoehrmann

    #2
    Re: XML Spec CharData doubt

    * Manish Tomar wrote in comp.text.xml:
    >I have a doubt in "CharData" grammar given XML 1.0 spec (http://
    >www.w3.org/TR/REC-xml/#NT-CharData).
    >
    >[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
    >
    >The text above [14] (in spec) describing CharData says that char data
    >must not have following chars: ^,<,& and it must not have ']]>' (CDATA
    >ending section) inside it. The grammar is given above. I was wondering
    >if the grammar can be written as
    >
    >CharData ::= [^<&]* - ']]>'
    >
    >Wouldnt this mean the same thing as the text describing [14]?
    No, a string like "...]]>..." is not allowed by the original production
    but is allowed by your rewrite. The productions match the whole string,
    they don't look at whether a string contains something that matches, un-
    less you write it as the original does.
    --
    Björn Höhrmann · mailto:bjoern@h oehrmann.de · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

    Comment

    • Richard Tobin

      #3
      Re: XML Spec CharData doubt

      In article <1180327661.039 454.136170@r19g 2000prf.googleg roups.com>,
      Manish Tomar <manish.tomar@g mail.comwrote:
      >[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
      >
      >The text above [14] (in spec) describing CharData says that char data
      >must not have following chars: ^,<,& and it must not have ']]>' (CDATA
      >ending section) inside it. The grammar is given above. I was wondering
      >if the grammar can be written as
      >
      >CharData ::= [^<&]* - ']]>'
      >
      >Wouldnt this mean the same thing as the text describing [14]?
      A production "A - B" means all the strings that match A, but which don't
      match B. If we used your production, we would accept strings like

      xyz]]>xyz

      because it matches A and doesn't match B. The production could have been
      more concisely written as

      [^<&]* - ( .* ']]>' .* )

      but presumably it was thought clearer to restrict the second part to
      be a subset of the first. (In fact, I don't think the XML spec uses
      "." at all.)

      -- Richard

      --
      "Considerat ion shall be given to the need for as many as 32 characters
      in some alphabets" - X3.4, 1963.

      Comment

      • Manish Tomar

        #4
        Re: XML Spec CharData doubt

        Thanks a lot guys! :)
        I also checked out the the Notation section in the spec and your
        explanations were clear.

        Comment

        • Manish Tomar

          #5
          Re: XML Spec CharData doubt

          Thanks a lot guys! :)
          I also checked out the the Notation section in the spec and your
          explanations were clear.

          Comment

          Working...