[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [egov] Internet Draft - URN Application
Colin: It is interesting. I just scanned it and it seems to build on earlier RFC's by Roy Fielding and Michael Mealling (spelling??). There are a couple of things that I found confusing in the initial statement. I am not really sure what the problem is with conflicts of namespaces since parsers always resort to the inner most lexically scoped namespace. In any event, you would need a conflict of both the namespace itself AND the namespace value before any harm was done. An example: <?xml version="1.0"?> <document xmlns:foo="http://www.value1.com" > <!--If you do a "getNamespace()" on the following element, it will return the value of "www.value1.com"--> <foo:name>Duane Nickull</foo:name> <InnerElement xmlns:foo="http://www.value2.com"><name/> <!-- if you do the same "getNamespace()" operation on the next line, the value will be www.value2.com--> <foo:name>Duane Nickull</foo:name> </InnerElement> </document> The code to run this is attached. It requires JDOM b8 or higher to run but it gives you the idea. If you compile and run it, it will work. The other things that I always caution about is that no one should extend the basic function on namespaces for resolution. The danger is that if someone does this, then the W3C at some future point defines some additional functionality for namespaces, there may be a conflict. In general, namespaces are greatly misunderstood. The value attributes for namespaces need to be unique and that is why URL's are commonly used since they are guaranteed to be unique. There are of course problems with this since a domain name could be abandoned and resold while the namespace prefix is still in use or two competing entities at some organization could also declare the same namespace value by coincidence with the same namespace although the possibility of doing so is probably very rare. Even if it is done, it should not create a problem. I will read it when I have more time and may make additional comments. Duane Nickull colin.wallis@ssc.govt.nz wrote: >e-Government TC > >I'd welcome any comments on the following Internet-Draft authored by Ferry Hendrikx and myself. > >https://datatracker.ietf.org/public/idindex.cgi?command=id_detail&id=12811 > >Given that this is the first time (that I am aware of) a country has moved this far on namespaces, there was a flurry of initial comment as the URN and URL camps brought their opposing views to bear. But that seems to have calmed down now. > >Early comments on the home front are generally positive. > >I look forward to yours. > >Many thanks > >Colin > >Colin Wallis >Senior e-GIF Business Analyst >e-Government Unit - State Services Commission >New Zealand > >http://www.e.govt.nz > > > -- *********** Senior Standards Strategist - Adobe Systems, Inc. - http://www.adobe.com Vice Chair - UN/CEFACT Bureau Plenary - http://www.unece.org/cefact/ Adobe Enterprise Developer Resources - http://www.adobe.com/enterprise/developer/main.html ***********
import org.jdom.*; import org.jdom.input.SAXBuilder; import org.jdom.Namespace; import java.io.FileInputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.FileOutputStream; /** * utility to demonstrate namespaces and the misconception that conflicting namespace * prefixes cannot be solved by parsers. * * JDOM can be downloaded from jdom.org. Used build 8. * * @author Duane Nickull (dnickull@adobe.com) */ public class NamespaceDemo { static Namespace NS1 = Namespace.getNamespace("http://www.value1.com"); static Namespace NS2 = Namespace.getNamespace("http://www.value2.com"); public static void main(String[] args) { if (args.length != 1) { System.out.println( "Usage: java <xmlInstance.xml>"); System.exit(-1); } try { // get the root element object Element rootElement = new SAXBuilder().build(args[0]).getRootElement(); // just checking.. System.out.println("rootelement is" + rootElement); /* The following two println's should print the java object but * recognize different namespaces. It should default to show the * nearest lexically scoped NS. JDOM does this properly. Not all parsers * can replicate this behaviour. */ Element firstQE = rootElement.getChild("name", NS1); System.out.println( "Found element: " + firstQE); Element inner = rootElement.getChild("InnerElement").getChild("name", NS2); System.out.println("Found element: " + inner); } catch (Exception e) { System.err.println("Error encountered: " + e.getMessage()); System.exit(-1); } System.exit(0); } }
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]