DTD Any vs. XML Schema anyType

Discussion in 'XML' started by Razvan, Feb 19, 2005.

  1. Razvan

    Razvan Guest

    Hi



    After playing with XML Spy I saw that in DTDs the element of type
    "any" could contain text and any element that was declared in the DTD.
    In XML Schema an element of type anyType can contain *any* kind of
    tags, even tags that were not previously defined in the XML Schema.

    I am reading the book "Professional XML" that claims the 2
    declarations are completely identical. Where is the truth ?



    Regards,
    Razvan
     
    Razvan, Feb 19, 2005
    #1
    1. Advertising

  2. Razvan

    Peter Flynn Guest

    Razvan wrote:

    > Hi
    >
    >
    >
    > After playing with XML Spy I saw that in DTDs the element of type
    > "any" could contain text and any element that was declared in the DTD.
    > In XML Schema an element of type anyType can contain *any* kind of
    > tags, even tags that were not previously defined in the XML Schema.
    >
    > I am reading the book "Professional XML" that claims the 2
    > declarations are completely identical. Where is the truth ?
    >


    In the XML Specification, under section 3 Logical Structures, production 39,
    validity constraint 4:

    4. The declaration matches ANY, and the content (after replacing any
    entity references with their replacement text) consists of character
    data and child elements whose types have been declared.

    Do W3C Schemas not necessarily have to describe valid documents?

    ///Peter
    --
    "The cat in the box is both a wave and a particle"
    -- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
     
    Peter Flynn, Feb 20, 2005
    #2
    1. Advertising

  3. Razvan

    Razvan Guest

    In XML Spy 2005 I tried the above. When DTDs are used for validation
    only elements are that are declared are allowed inside the "ANY"
    element. However, if I try the same with an associated XML Schema
    anything is permitted inside an element of type "anyType". Is XML Spy
    broken ?



    Thanks,
    Razvan
     
    Razvan, Feb 20, 2005
    #3
  4. Razvan

    Peter Flynn Guest

    Razvan wrote:

    > In XML Spy 2005 I tried the above. When DTDs are used for validation
    > only elements are that are declared are allowed inside the "ANY"
    > element.


    That is correct.

    > However, if I try the same with an associated XML Schema
    > anything is permitted inside an element of type "anyType". Is XML Spy
    > broken ?


    It sounds like it, but I don't know if W3C Schemas follow the same rule
    as DTDs on this point. My $0.02 is that they should, but doubtless
    someone can come up with a convincing reason why they shouldn't.

    ///Peter
    --
    "The cat in the box is both a wave and a particle"
    -- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
     
    Peter Flynn, Mar 2, 2005
    #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. Markus
    Replies:
    1
    Views:
    1,670
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,330
    Stanimir Stamenkov
    Apr 25, 2005
  3. Replies:
    1
    Views:
    365
    Diez B. Roggisch
    Sep 5, 2006
  4. shrikant
    Replies:
    0
    Views:
    2,305
    shrikant
    Dec 20, 2006
  5. pramodr
    Replies:
    3
    Views:
    879
    Peter Flynn
    Apr 5, 2009
Loading...

Share This Page