On Mon, Nov 12, 2001 at 06:19:39PM +1100, Peter Donald wrote: > On Sun, 11 Nov 2001 16:46, Jeff Turner wrote: > > Was thinking.. the namespace prefix (the foo in xmlns:foo="..") is just > > a convenient XML-specific notation by which a namespace URI can be > > associated with elements. > > > > So why do we want to expose it to users through Namespace.getPrefix()? > > I have a use case - not valid XML usage though ;) Basically in Ant2 we were > talking about basing decisions around namespace prefix (but completely > ignoring the URI part). Not sure if this is a good idea as such ... ;)
It sounds.. ick :) But I'm sure you know what you're doing. Sooo.. - Pete want to do weird stuff with Ant - Berin wants to parse WSDL, hence needs namespaces - Leo Sutic wants a getValueAsDOM() - Some people apparently want read-write access - I want to add XHTML nodes (mixed content) Perhaps it's time to subclass Configuration? NamespaceConfiguration AntNamespaceConfiguration WriteableConfiguration SemistructuredConfiguration Then there could be a dom4j implementation that implements Namespace, Writeable and Semistructured. Then maybe not.. I'm only suggesting it because adding Namespace support is proving surprisingly difficult. > > Furthermore, Configuration is an interface, but Namespace is a final > > class. To implement any non-XML Configuration implementation will > > require hauling along this fully useless (outside the context of XML) > > Namespace class. > > Not sure what you mean. Can you qualify? What case would there be where you > would want to extend Namespace ? Imagine I want to implement a Configuration built from a JNDI tree, rather than an XML file (yes, I really do at some stage). Say I'm in the JNDI context "dc=myComponent,dc=myProgram,dc=myCompany,dc=net,dc=au". It makes perfect sense for getNamespace() to return that string, since a JNDI "context" is basically a namespace. However, my JNDI namespace has no notion of a "prefix". All it has is that string, a URI, which can be written as "jndi://dc=myCompnent,...". So in order to support this level of generality, I think Namespace should be an interface that has only two methods: public String getURI(); public boolean equals(Object o); --Jeff > -- > Cheers, > > Pete -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>