|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Fixing Namespaces in XML; my two cents
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








