DTD element type declaration

Discussion in 'XML' started by Imiro, Aug 24, 2004.

  1. Imiro

    Imiro Guest

    Hi,

    Trying to validate this dtd example with xml-spy 5 pro:

    This works:
    <!ELEMENT note (#PCDATA|body)*>
    <!ELEMENT body (#PCDATA)>

    This doesnt:
    <!ELEMENT note (#PCDATA|body)>
    <!ELEMENT body (#PCDATA)>

    Is this a bug when 'char or char' is allowed when repeating zero or more times?

    Thanks,

    Imiro
    Imiro, Aug 24, 2004
    #1
    1. Advertising

  2. "Imiro" <> wrote in message
    news:...
    > Trying to validate this dtd example with xml-spy 5 pro:
    >
    > This works:
    > <!ELEMENT note (#PCDATA|body)*>
    > <!ELEMENT body (#PCDATA)>
    >
    > This doesnt:
    > <!ELEMENT note (#PCDATA|body)>
    > <!ELEMENT body (#PCDATA)>



    The SP parser (nsgmls program) reports the error "#PCDATA in model group
    that does not have REP occurrence indicator".

    The "SGML Handbook" offers this explanation: "#PCDATA should be used in a
    content model only when the intention of the content model is to allow
    inter-mixed data with whatever elements are permitted - in other words,
    where the content model is a repeatable OR group."

    If you really need to restrict the note element to contain one body, you
    might want to avoid the mixed content model altogether. (Mixed content means
    parsed character data may be mixed with element content.) Something like
    this:

    <!ELEMENT note (comment?, body, comment?)>
    <!ELEMENT comment (#PCDATA)>
    <!ELEMENT body (#PCDATA)>

    /kmc
    Keith M. Corbett, Aug 24, 2004
    #2
    1. Advertising

  3. In article <>,
    Imiro <> wrote:

    >This doesnt:
    ><!ELEMENT note (#PCDATA|body)>


    That's not allowed. The only legal mixed content declarations are
    ones of the form

    (#PCDATA)
    (#PCDATA)*
    (#PCDATA | name | name ...)*

    See http://www.w3.org/TR/REC-xml/#sec-mixed-content

    -- Richard
    Richard Tobin, Aug 24, 2004
    #3
  4. Imiro

    Imiro Guest

    Thanks, this was what i needed to know. I'm Converting old sgml DTD
    thats loaded with mixed content, that won't validate :p

    --Imiro
    Imiro, Aug 25, 2004
    #4
    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. Joseph Tilian
    Replies:
    0
    Views:
    338
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,742
    Ronald Fischer
    Mar 17, 2005
  3. Simon Brooke
    Replies:
    5
    Views:
    743
    Simon Brooke
    Jul 25, 2003
  4. test
    Replies:
    2
    Views:
    1,993
    Oliver Wong
    Jul 28, 2006
  5. Luca Forlizzi
    Replies:
    4
    Views:
    443
    Luca Forlizzi
    Nov 14, 2010
Loading...

Share This Page