ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
[xml-dev] DSDL: use cases: namespace declaration notation
by james anderson other posts by this author
Jun 13 2002 3:47PM messages near this date
Re: [xml-dev] Come On, DTD, Come On! Thoughts on DSDL Part 9 | [xml-dev] Re: [dsdl-comment] DSDL: use cases: namespace declaration notation
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>
>  

Disagreed.

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

One of the likely uses for an extended DTD notation would be definitions which combine exist
ing DTD-encoded definitions which
are not namespace-aware. In order for the extended notation to integrate such definitions, i
t must be able to declare
prefix/namesace-name bindings which have a scope which corresponds to the lexical scope of b
indings 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 ac
complish nothing more than to
duplicate the effect of propagating the bindings effected by declared attributes. In which c
ase, the additional notation is redundant.

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

? (defParameter *doc-node-combination*
  (document-parser
  "<!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>'>
    %dtd1;
    <!ATTLIST y xmlns CDATA 'data:,ns-b'> 
    <!ENTITY % dtd2 SYSTEM 'data:,<!ELEMENT y (b)*>  <!ELEMENT b EMPTY>'>
    %dtd2;
    ]> 

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

*DOC-NODE-COMBINATION*

;; 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)* > 
 <!ATTLIST x 
   xmlns CDATA  'data:,ns-a' > 
 <!ELEMENT a EMPTY > 
 <!ELEMENT y (b)* > 
 <!ATTLIST y 
   xmlns CDATA  'data:,ns-b' > 
 <!ELEMENT b EMPTY > 
 ]> 

<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> 

#<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))))

{data:,ns-b}b
{data:,ns-a}x
{data:,ns-doc}doc
{data:,ns-a}a
{data:,ns-b}y

NIL
? 

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

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

{data:,ns-doc}doc
{data:,ns-a}x
{data:,ns-a}a
{data:,ns-b}y
{data:,ns-b}b

NIL
? 
 

...

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org> 

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl> 
Thread:
John Cowan
Marcus Carr
Eric Bohlman
Marcus Carr
james anderson
james anderson
james anderson
Marcus Carr
Arjun Ray
Marcus Carr
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Deborah Aleyne Lapeyre
John Cowan
Thomas B. Passin
Ronald Bourret
Ronald Bourret
Michael Kay
Thomas B. Passin
james anderson
David Carlisle
james anderson
David Carlisle
james anderson
David Carlisle
james anderson
Michael Kay
james anderson
David Carlisle
Tim Bray
Ronald Bourret
Ronald Bourret
Ronald Bourret
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
John Cowan
John Cowan
james anderson
John Cowan
Rick Jelliffe
Arjun Ray
John Cowan
Rick Jelliffe
Rick Jelliffe
Dennis Sosnoski
John Cowan
Dennis Sosnoski
John Cowan
Dennis Sosnoski
Arjun Ray
G. Ken Holman
John Cowan
Arjun Ray
james anderson
Arjun Ray
John Cowan
Arjun Ray
Rick Jelliffe
John Cowan
Arjun Ray
John Cowan
John Cowan
james anderson
John Cowan
james anderson
james anderson
John Cowan
james anderson
james anderson
John Cowan
Ronald Bourret
Ronald Bourret
Jonathan Borden
Ronald Bourret
Michael Fuller
John Cowan
Bob Hutchison
james anderson
Thomas B. Passin
John Cowan
Ronald Bourret
John Cowan
Thomas B. Passin
Ronald Bourret
Ronald Bourret
james anderson
Norman Walsh
K. Ari Krupnikov
John Cowan
John Cowan
K. Ari Krupnikov
John Cowan
G. Ken Holman
Ronald Bourret
Rick Jelliffe
John Cowan
Marcus Carr
G. Ken Holman
John Cowan
Michael Fitzgerald
Paul Prescod
John Cowan
John Cowan

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved