Berin Loritsch a écrit :
<snip/>
> > >
> > > > > > The only use I can see for the prefix is for XML serialization. We 
> > > > > > could
> > > > > > either :
> > > > > > - have the serializer auto-generate prefixes (ns1, ns2, etc), 
> > > > > > possibly
> > > > > > with the help of a Map of default prefix/URI mappings,
> > > > > > - keep prefixes in Configuration only as a serialization hint. But
> > > > > > application code using Configuration objects shouldn't have to worry
> > > > > > about it, meaning as above automatic prefix generation for
> > > > > > Configurations created by the application.
> > > > >
> > > > > The consept behind the Namespace object was to maintain the prefixes 
> > > > > that
> > > > > the administrator chose, but only use the prefix as a serialization 
> > > > > hint.
> > > > > Granted that can be accomplished by making the getPrefix() method 
> > > > > protected.
> > > > > But then you are stuck with the ConfigurationSerializer in the 
> > > > > configuration
> > > > > package.
> > > >
> > > > It could be public, but clearly identified as being a hint and allowed
> > > > to return null.
> > >
> > > The current implementation does not return null, but an empty string.  
> > > That way
> > > we avoid NPE all over the place--and can simplify if/then/else statements.
> >
> > Mmmh... IMO, null and "" have different meanings :
> > - null means no prefix is associated with the Configuration object and
> > the serializer must determine the actual prefix, either by checking
> > already declared prefixes (NamespaceSupport makes this easy) or by
> > generating a new prefix.
> > - "" means the namespace is the default one like in <foo
> > xmlns="foo-namespace"/> and is a valid value for the prefix.
> 
> Keep in mind, this is what the Namespace Aware parsing does.  You never have
> null namespaces.  It is either default (xmlns="") or specified.

I was talking of what could be done if Namespace was removed and
replaced by Configuration.getNamespaceURI() and
Configuration.getNamespacePrefixHint(). What do you think about it ?

BTW, there's a typo in DefaultConfigurationSerializer at line 135 :
"prefix" should be "nsPrefix".
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to