|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Does DTD validation work with namespaces?
This message, sent last night, appears not to have made it to the list because of email problems. I am reposting it. My apologies if anyone gets it twice. Norman, this email also addresses the "arbitrary mixtures" that you don't like. If I specify ANY in my DTD, then the mixtures aren't arbitrary anymore. Anyhow, I won't bother you with this issue anymore. Thanks, Todd <NormanWalsh> > My personal, default model of validation is very strict and draconian. > A document is valid if and only if every child of element 'A' is > listed in the content model of element 'A' and the children occur in a > number and sequence that is allowed by the content model in question. > > So, in my model, you cannot have > > <foo:a><bar:b/></foo:a> > > unless the content model of foo:a explicitly allows bar:b as its first > and only child. (Where "explicitly allows" may include DTD-style ANY > content models or XML Schema style "selective any" content models). > > This is irrespective of whether or not you are in control of the > schemas that you're using. > > This is *clearly* not the only validation model that one could imagine. > It is *equally clear* that this model doesn't work in all cases. </NormanWalsh> Norman: This is the same idea of validation that I have as well. The question is the rules/means by which you allow/declare additional elements where the DTD allows ANY. I just wrote the following to Marcus Carr: =========== Why couldn't you use this same idea, but instead of relying on finding a DOCTYPE (which would mean a change in XML 1.0), you simply pay attention to the declared namespace and use the namespace URI to go fetch a DTD. I may be way off base on this, but it seems to me, this would not require a change in DTD syntax. It would not require a change in Namespace syntax. It would simply mean a change in the rule that the resource at the end of the URI is irrelevant and it would mean extra work (and new behavior rules) for a DTD validating parser. I mentioned in an earlier post the difference between (1) non-validating parser (2) validating parser (which everyone understands) and (3) a proposed DTD-Namespace-aware validating parser. ========== When I say, "new behavior rules" I do not mean you could simply allow new elements to be inserted into a well-formed document, from a different namespace, when you have this: <!DOCTYPE Address [ <!ELEMENT Address (Street+,City,State,PostalCode,Country) > <!ELEMENT Street (#PCDATA) > <!ELEMENT City (#PCDATA) > <!ELEMENT State (#PCDATA) > <!ELEMENT PostalCode (#PCDATA) > <!ELEMENT Country (#PCDATA) > ]> That is, you can't do this: <Address> <H1>This is what I unilaterally decided to put here today.</H1> <Street>2356 Peachtree Street</Street> <City>Atlanta</City> <State>Georgia</State> <PostalCode>30302</PostalCode> <Country>U.S.A.</Country> </Address> I would not want to allow the insertion/mixing of <H1> either if the "Address" DTD were mine. However, if the "parent" DTD (for lack of a better word) were to allow ANY in one or more places, then you could add otherwise undeclared elements from a different namespace where ANY content is allowed (along the lines of what I suggest to Marcus). This would allow you to use elements from someone else's DTD without having to create one big DTD and you might also be able to take advantage of some of the Namespace features (defaulted prefixes, for instance), which I can't see how you would do otherwise. Again, I could be way off base on this, but I'd appreciate any feedback. Thanks, Todd
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








