OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: External DTD & namespaces

[ Lists Home | Date Index | Thread Index ]
  • From: james anderson <James.Anderson@mecomnet.de>
  • To: W3CXMLDevelopers <xml-dev@ic.ac.uk>
  • Date: Wed, 23 Dec 1998 03:20:16 +0100

David Brownell wrote:
> Andy Malakov wrote:
> >
> > I want to use namespace prefixes in element declarations of the
> > external/internal DTDs.
> > ...
> > Where I should put "myns" namespace declaration?
> <!ATTLIST myns:point
>         xmlns:myns CDATA #FIXED
>                 "http://www.ptc.com/xml/something/goes/here"
>         >
> Keep in mind that if you put this in some external parameter
> entity (e.g. the unnamed one in <!DOCTYPE foo SYSTEM "xyz.dtd">
> some nonvalidating parsers will give you a hard time. 

within the terms of the proposed recommendation even a conforming validating
parser would be hard pressed to do better. a conforming means is yet to be
specified whereby a parser can establish the identity of identifiers in either
the external or the internal dtd.

> Where namespaces and DTDs really clash is when you might want
> to change the prefix ("myns") associated with some URI.

which clash is the source of the problem.

this is not to say that it is not possible to specify this identity. the
problem is just strictly in terms of the pr: it omits the necessary binding
form and the rules for scoping within the dtd. as previously noted, one can
wait for the "future work on XML schemas" which will be able to take advantage
of attribute-based prefix bindings. a second option is to depend on the parser
of ones choice to
a) expose the name-qualification mechanism (prefix binding and universal name
construction), and
b) report processing instructions.
and implement the binding mechanism onesself.

[a side-point re (a) and a previous response on the related thread: "Re: DOM
Level 1 and namespaces"
 i would find an interface of the following form much more useful
  interface NamespaceScoped extends Node {
                UniversalName Node.getNodeName();
  interface UniversalName extends *?* {  // sorry, i don't know your domains
                                         // it's likely a concrete class, 
rather than
                                         // just an interface, but i make no
claims about
                                         // where it fits among your DOM classes
                String getLocalName ();
                String getNamespace ();

if these prerequisites are satisfied, then both unambiguous name qualification
and, as a consequence, validation are possible in the presence of otherwise
ambiguous local-name-parts and or prefixes.

to wit:


? (in-package "XML-PARSER")
#<Package "XML-PARSER">
;; read a document, here with an internal subset only, but that's not significant
;; note the ambiguous local parts and prefixes
? (defParameter *test-document*
    "<?xml version='1.0' standalone='yes'?>
<!DOCTYPE named [
 <?namespace xmlns:='ns.1'  ?>
 <!ELEMENT repeated (a , b) >
 <?namespace xmlns:='ns.2'  ?>
 <!ELEMENT repeated (a , b) >
 <?namespace xmlns:='ns.3' xmlns:one='ns.1' xmlns:two='ns.2' ?>
 <!ELEMENT named (one:repeated, two:repeated) >

<named xmlns:='ns.3'>
 <repeated xmlns:='ns.1'><a/><b/></repeated>
 <repeated xmlns:='ns.2'><a/><b/></repeated>


;; in spite of the "ambiguity" validation is possibly.
? (document.valid? *test-document*)

;; now, just to demonstrate the "identity" of the names, we "break" the document.
? (defParameter *test-element* (document.element *test-document*))
? (first (element.content *test-element*))
#<ELEMENT XMLNS.4::|repeated|>
? (element.content (first (element.content *test-element*)))
? (second (element.content *test-element*))
#<ELEMENT XMLNS.5::|repeated|>
? (element.content (second (element.content *test-element*)))
? (rotatef (first (element.content (first (element.content *test-element*))))
           (first (element.content (second (element.content *test-element*)))))

;; the root element now looks like this. note the additional (internal) prefix bindings
;; which appear as a consequence of the indefinite extent of the respective URI
? (pprint *test-element*)

<named xmlns='ns.3'>
 <repeated xmlns='ns.1'>
  <XMLNS.5:a XMLNS.5=ns.2/>
 <repeated xmlns='ns.2'>
  <XMLNS.4:a XMLNS.4=ns.1/>
#<ELEMENT XMLNS.6::|named|>

? (reset-element.valid? *test-element*)
;; which resulting element is, of course, no longer valid:
;; it fails to conform to the model at the point where a ns.2:a element was
found where
;; a ns.1:a element was expected...
? (document.valid? *test-document*)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS