XML Spec CharData doubt

Discussion in 'XML' started by Manish Tomar, May 28, 2007.

  1. Manish Tomar

    Manish Tomar Guest

    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.
    Manish Tomar, May 28, 2007
    #1
    1. Advertising

  2. * 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: · 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/
    Bjoern Hoehrmann, May 28, 2007
    #2
    1. Advertising

  3. In article <>,
    Manish Tomar <> wrote:

    >[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

    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
    Richard Tobin, May 28, 2007
    #3
  4. Manish Tomar

    Manish Tomar Guest

    Thanks a lot guys! :)
    I also checked out the the Notation section in the spec and your
    explanations were clear.
    Manish Tomar, May 28, 2007
    #4
  5. Manish Tomar

    Manish Tomar Guest

    Thanks a lot guys! :)
    I also checked out the the Notation section in the spec and your
    explanations were clear.
    Manish Tomar, May 28, 2007
    #5
    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. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    594
  2. Andrew Chen
    Replies:
    1
    Views:
    180
    David Chelimsky
    Mar 25, 2008
  3. Replies:
    0
    Views:
    536
  4. Peter Otten
    Replies:
    2
    Views:
    102
    Cousin Stanley
    Aug 10, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    105
    Terry Reedy
    Aug 10, 2013
Loading...

Share This Page