Namespaces and DTDs was RE: Namespaces and interoperability (was Re: SAX, Java, and Namespaces)

Borden, Jonathan jborden at mediaone.net
Sun Feb 7 00:13:46 GMT 1999


James Robertson wrote:

>
> Well, let me put it like this then:
>
> You are working out a structured interchange format. If you
> want structure, you'll need a DTD, otherwise there is absolutely
> no way of validating that you have got correct data.
>
> If you have a DTD, then namespaces are irrelevant: they simply
> don't work together in any meaningful way.
>
> Or to put it another way: allowing arbitrary nesting of someone
> else's tags doesn't achieve anything. You still have to know
> what to do with them when you receive them.
>
> In summary: get stuck into writing a DTD, and ignore this
> whole "namespaces" mess ...
>

	It has been previously discussed that we need to use the namespace prefix
as declared in the DTD in order to validate XML documents with namespaces.

	Would explicit declaration of namespace URIs as an attribute allow
*namespace aware validators* to correctly validate documents in namespace
URI dependent way as opposed to a prefix dependent way.

	Use attribute declarations to declare namespaces:

<!ELEMENT example (a|b|aaa:p|xxx:y)>
<!ATTLIST example
		xmlns:aaa CDATA #DEFAULT "urn:aaa"
		xmlns:xxx CDATA #DEFAULT "urn:xxx">
<!ELEMENT xxx:y (#PCDATA)>
<!ELEMENT html:p (#PCDATA)>

so

<example>
<aaa:p> whatever </aaa:p>
<xxx:y> something else </xxx:y>
</example>

is valid as well as

<example xmlns:bbb="urn:aaa"
	   xmlns:yyy="urn:xxx">
<bbb:p> another </bbb:p>
<yyy:y> example </yyy:y>
</example>

	Is this what has been suggested before (and I am just getting it :-)?


Jonathan Borden
http://jabr.ne.mediaone.net


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list