[I note a mistake in that I'm trying to register the xmldb URL scheme,
not protocol. Low on caffeine this evening...]

Mario Cormier wrote:
Try java.net.URI instead of java.net.URL. Basically you can think of a URI as a URL of an unknown type.

Hope this helps!

Mario,

The difference between the two is more than just that URIs don't come
with a set of defined schemes, they also don't perform any of the
functions that URLs (in Java) do, such as provide a resolution service.
The Javadocs for each hilight the difference:

  "[A] URI instance is little more than a structured string that
   supports the syntactic, scheme-independent operations of comparison,
   normalization, resolution, and relativization."

whereas:

  "[A] URL is a structured string that supports the syntactic operation
   of resolution as well as the network I/O operations of looking up
   the host and opening a connection to the specified resource."

If there's a way to register the xmldb: scheme in Java, then the
creation of an xmldb URL would enable the openConnection() method
providing access to the Xindice resource. Also, the openStream()
method would provide an InputStream for reading the Xindice-based
resource. This would fully "web-enable" Xindice in the Java sense.

So I am asking for the moon.  :-)

Murray Altheim wrote:


I thought perhaps if I needed an answer to this question, others
might as well. I also figure that someone on this list has the
answer to this one at their fingertips...

For those programming in Java, the java.net.URL class is
ubiquitous. But creating a URL with 'xmldb' such as

 xmldb:xindice-embed:///db/documentation/overview

will result in

  [java] java.net.MalformedURLException: unknown protocol: xmldb
  [java]     at java.net.URL.<init>(URL.java:586)
  [java]     at java.net.URL.<init>(URL.java:476)
  [...]

which never feels all that much like a warm puppy or a cold beer.

So the question is: how does one register a new protocol in Java
so that you can create xmldb URLs and obtain a valid String when
doing getProtocol()?

Secondly, is the protocol "xmldb" or "xmldb:xindice-embed"? If not
the latter, what component of the URL is "xindice-embed" in the
URL scheme of things? I don't see this in the URL RFC.

Thanks!

Murray

......................................................................
Murray Altheim                    http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK               .

  "Ours is a dangerous time with two relatively new threats,
   both of them exacerbated by the Iraq invasion and this
   administration's policies. One is the threat of future
   terrorism by Osama and al Qaeda. The other is the threat
   to our freedoms and our constitutional republic. These
   are dangers that were never faced before in my lifetime."
                                             -- Daniel Ellsberg
   
http://www.sfgate.com/cgi-bin/article.cgi?file=/chronicle/archive/2004/02/29/CMG3R50LHE5.DTL



Reply via email to