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


Help: OASIS Mailing Lists Help | MarkMail Help



   DSDL: use cases: namespace declaration notation

[ Lists Home | Date Index | Thread Index ]

John Cowan wrote:
> ...
> 1) The NS declaration.  Declarations of the form <!NS name SYSTEM "uri">
> are allowed to define the namespaces associated with CNames in ELEMENT
> and ATTLIST declarations.  As is the case for other schema languages, in
> the presence of a known prefix, name matching is done on the universal
> name (URI + local-part) rather than the CName.  The default namespace
> is declared using #DEFAULT in place of the name.
> Example:
> <!NS foo SYSTEM "http://www.example.com/foo";>
> <!NS bar SYSTEM "http://www.example.com/bar";>
> <!ELEMENT foo:a (foo:b)>
> <!ELEMENT bar:a EMPTY>


A namespace declaration should take the form of an attribute declaration.
The scope of the namespace declaration is the respective element declaration, and the closure of the respective contained
element and attribute declarations, subject to the limiting effect of contained attribute declarations.

One of the likely uses for an extended DTD notation would be definitions which combine existing DTD-encoded definitions which
are not namespace-aware. In order for the extended notation to integrate such definitions, it must be able to declare
prefix/namesace-name bindings which have a scope which corresponds to the lexical scope of bindings which appear in elements.

A free <!NAMESPACE ... > form is ill suited to this end. While one could address this issue in combination with free
declarations by specifying shadowing and overriding rules for such forms, those rules can accomplish nothing more than to
duplicate the effect of propagating the bindings effected by declared attributes. In which case, the additional notation is redundant.

For example, in the following, the respective document definitions for the "x" and "y" document forms are constrained by the
attribute declarations which appear in the compound definition.

? (defParameter *doc-node-combination*
  "<!DOCTYPE doc [
    <!ELEMENT compound:doc (x, y)* >
    <!ATTLIST compound:doc xmlns:compound CDATA 'data:,ns-doc'>
    <!ATTLIST x xmlns CDATA 'data:,ns-a'>
    <!ENTITY % dtd1 SYSTEM 'data:,<!ELEMENT x (a)*> <!ELEMENT a EMPTY>'>
    <!ATTLIST y xmlns CDATA 'data:,ns-b'>
    <!ENTITY % dtd2 SYSTEM 'data:,<!ELEMENT y (b)*> <!ELEMENT b EMPTY>'>

   <compound:doc xmlns='data:,ns-doc'>
     <x xmlns='data:,ns-a'><a/></x>
     <y xmlns='data:,ns-b'><b/></y>


;; The reserialized document demonstrates that attribute declarations
;; are sufficient to infer that the "x" and "y" names in the
;; "{data:,ns-doc}doc" content model are, in fact, in distinct namespaces:

? (write-node *doc-node-combination* *trace-output* :encoding :usascii)

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<!DOCTYPE doc [
 <!ENTITY % dtd2 SYSTEM 'data:,&lt;!ELEMENT y (b)*&gt; &lt;!ELEMENT b EMPTY&gt;' >
 <!ENTITY % dtd1 SYSTEM 'data:,&lt;!ELEMENT x (a)*&gt; &lt;!ELEMENT a EMPTY&gt;' >
 <!ELEMENT compound:doc (nsp-1:x, nsp-2:y)* >
 <!ATTLIST compound:doc 
   xmlns:compound CDATA  'data:,ns-doc' >
 <!ATTLIST compound:doc 
    xmlns:nsp-2 CDATA 'data:,ns-b'
    xmlns:nsp-1 CDATA 'data:,ns-a' >
 <!ELEMENT x (a)* >
   xmlns CDATA  'data:,ns-a' >
 <!ELEMENT y (b)* >
   xmlns CDATA  'data:,ns-b' >

<doc xmlns='data:,ns-doc' xmlns:compound='data:,ns-doc'>
     <x xmlns='data:,ns-a'><a /></x>
     <y xmlns='data:,ns-b'><b /></y>

#<DOC-NODE <no uri> #x9849626>

;; That is, the attribute declarations are sufficient to constrain
;; the namespace assigment within the DTD ...

? (xqdm::walk-element-definitions *doc-node-combination*
                                  #'(lambda (def) (pprint (name def))))



;; in the same manner as xml-names requires for elements:

? (xqdm::walk-elements *doc-node-combination*
                       #'(lambda (element) (pprint (name element))))





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

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