DTD Any vs. XML Schema anyType

R

Razvan

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
 
P

Peter Flynn

Razvan said:
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
 
R

Razvan

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
 
P

Peter Flynn

Razvan said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top