Style RFC: Avoiding use of default namespace
David Crawshaw <[email protected]> Thu, 25 Dec 2003 22:23:37 +1000
| Newsgroups | gmane.comp.java.xwt.widgets |
|---|---|
| Message-ID | <[email protected]> |
Most of the code in the niwi module has lines like:
<xwt xmlns="xwt.theme" xmlns:lib="...">
The above line sets the default namespace to xwt.theme. I would like to
suggest we avoid this, for three reasons:
1) It sets a bad example for user applications, where
it will cause havoc. Eg, org/xwt/sampler/main.xwt:
<xwt xmlns="xwt.widget">
<template>
<box fill=".org.xwt.sampler.test" />
</template>
</xwt>
The above fails, as the core attaches the default
uri for an image lookup and tries to find:
./xwt/widget/org/xwt/sampler/test[.png/.jpg/.gif]
2) XWT almost makes complete use of the Namespacing
spec, with one exception. The XWT tags themselves
should be defined by a Namespace (<xwt>, <box>,
<template>). If these tags are defined by a
Namespace, then they should be the default uri.
This is already the situation from a practical
perspective, I just want to formalise it by saying
it shouldn't be possible to redefine the default
Namespace.
3) Prefix standardisation. If we use prefixes for all
template access, then we can have a set of prefixes
that remain the same across the widget library, and
we can recommend for use in user applications.
widget - xwt.widget
theme - xwt.theme
lib - xwt.lib
... etc
At the moment, sometimes we have xmlns="xwt.widget",
and other times xmlns="xwt.theme". This means copy
and pasting an xml block from one file to another
will change the behaviour of the xml.
Thoughts?
d