[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: A proposal for application level XML 'namespaces'
Original Message From: "Michael Kay" I've separated replies to this message into two e-mails for easier issue tracking... > Element names are either absolute (e.g. <:com.example.myschema:parent>) or > "relative" (<child>) or prefixed (<myschema:uncle>). A relative name is > expanded using the 'namespace' of its nearest absolute container element; > if there is none, it is a no-namespace name. The prefix of a prefixed name > must match the trailing component(s) of a containing absolute name, and is > expanded to be in the namespace given by that absolute name. > > Attribute names are the same except that relative names are always > no-namespace names. > > Only absolute names are used in APIs; applications cannot tell whether a > name was written in full or in abbreviated form. I wonder whether the prefixed form can be removed in the interests of simplicity and just accept that in those corner cases where there's lots of interleaved namespaces you have to do it using absolute names. If necessary the vocabulary designers could register their prefix with the registry I talked about in my earlier mail. Thus they could register "myschema" as a prefix for "com.example.myschema" and then just use "myschema:parent". I like the idea of the APIs always reporting the absolute names. My concern with that is that it requires the parser to be re-written. However, if you're using an existing XML parser, I think you could easily pipeline the processing of the XML so that relative names are expanded to absolute names before being handed to your existing XML parser, e.g.: <:com.example.myschema:parent> <child>12</child> </:com.example.myschema:parent> gets pre-processed to: <:com.example.myschema:parent> <:com.example.myschema:child>12</:com.example.myschema:child> </:com.example.myschema:parent> My next thought is, do we need the colons in the names? Can we get away with names like "com.example.myschema.parent" and just say that the local part is a NDName (No Dot Name!)? My concern is that the presence of colons may cause existing parsers to attempt to handle the names as existing namespaces, and that could cause problems. Removing colons and adopting the same pre-processing means: <com.example.myschema.parent> <child>12</child> </com.example.myschema.parent> gets pre-processed to: <com.example.myschema.parent> <com.example.myschema.child>12</com.example.myschema.child> </com.example.myschema.parent> which I think looks pretty good! Pete Cordell Codalogic Ltd Interface XML to C++ the easy way using C++ XML data binding to convert XSD schemas to C++ classes. Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com for more info
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
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
|