[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Fixing Namespaces in XML; my two cents

  • To: xml-dev@l...
  • Subject: Fixing Namespaces in XML; my two cents
  • From: "James Cerra" <jc2astro@h...>
  • Date: Mon, 29 Jul 2002 16:18:44 -0400
  • Bcc:

host prefix
On the rare chance that someone might care what I think....

Namespaces seem to be a way to embed (read: bolt) one (or more) XML 
document(s) in another "root" document.  However, I believe that there are 
several problems with the spec:

1) Namespaces can be included in any start tag.  This assumes that a foriegn 
document can be inserted anywhere in the host document.  However, this may 
not always be the case.

2) Both the foriegn documents, the host document and the **total** document 
cannot be easily validated with current DTDs conventions.

3) The whole "namespace name = URI" is confusing and open to interpretation.

How does one overcome these problems?  Well, here's an idea:

Let's say we have host document with the DTD:

<!ELEMENT %hostPrefix;host (%hostPrefix;child1 | %hostPrefix;child2)*>
<!ELEMENT %hostPrefix;child1 #PCDATA>
<!ELEMENT %hostPrefix;child2 #PCDATA>

and the foriegn document:

<!ELEMENT %foriegnPrefix;foriegn (%foriegnPrefix;childA | 
%foriegnPrefix;childB)*>
<!ELEMENT %foriegnPrefix;childA #PCDATA>
<!ELEMENT %foriegnPrefix;childB #PCDATA>

Then we have the document (excuse "pretty" White Space):

<?xml version="1.0"?>
<!DOCTYPE host [
<!--
1. define foriegn prefix "f:"
2. define foriegn dtd for validation
-->
<!ENTITY % foreignPrefix "f:">
<!ENTITY % foreigndtd SYSTEM "http://www.foo.bar">
<!--
1. define host prefix "" for 'default' namespace
2. define host dtd for validation
3. define where foriegn language can go in
-->
<!ENTITY % hostPrefix "">
<!ENTITY % hostdtd SYSTEM "http://www.food.beer">
<!ELEMENT % child1 (#PCDATA | f:foriegn)*>
<!--
include the dtds
-->
%hostdtd;
%foriegndtd;
]>
<host>
<child1>blablabla</child1>
<child2>blablabla</child2>
<child1>
<f:foriegn>
<f:childA>blablabla</f:childB>
<f:childB>blablabla</f:childB>
</f:foriegn>
</child1>
</host>

Would that work as an alternate namespace scheme (althought is seems ugly, 
and error-prone too)?

---
Jimmy Cerra
"If the path is set in stone, use a sledgehammer"


_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.