Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > DTD Any vs. XML Schema anyType

Reply
Thread Tools

DTD Any vs. XML Schema anyType

 
 
Razvan
Guest
Posts: n/a
 
      02-19-2005
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

 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      02-20-2005
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_
 
Reply With Quote
 
 
 
 
Razvan
Guest
Posts: n/a
 
      02-20-2005
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

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      03-02-2005
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_
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New to xml schema - does the dtd/schema validation happens always ? pramodr XML 3 04-05-2009 12:10 PM
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Check XML Without any DTD or schema. gajewski.konrad@gmail.com Python 1 09-05-2006 11:06 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
Validating XML against a DTD that is not supplied in the XML Schema Ben Jessel Java 0 08-05-2004 11:45 AM



Advertisments