Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 80390 invoked from network); 9 May 2000 17:33:11 -0000 Received: from balld-0.dsl.speakeasy.net (HELO localhost.localdomain) (@216.254.77.75) by locus.apache.org with SMTP; 9 May 2000 17:33:11 -0000 Received: from localhost (balld@localhost) by localhost.localdomain (8.9.3/8.9.3) with ESMTP id MAA04607 for ; Tue, 9 May 2000 12:24:00 -0400 X-Authentication-Warning: localhost.localdomain: balld owned process doing -bs Date: Tue, 9 May 2000 12:23:59 -0400 (EDT) From: Donald Ball X-Sender: balld@localhost.localdomain To: Cocoon Subject: RE: extension questions (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N I didn't know this. This could have been an alternate solution to the cocoon:, sbk:, repository: URL factory mess. ---------- Forwarded message ---------- Date: Tue, 9 May 2000 10:22:07 -0700 From: "Sobeck, David" Reply-To: xalan-dev@xml.apache.org To: "'xalan-dev@xml.apache.org'" Subject: RE: extension questions You can do this without defining a servlet or running a web server/servlet engine. Java supports the definition of new protocols. When a URL is opened, a system property is examined for protocols which are not built in. If you append yourPackage.yourProtocol to the java.protocol.handler.pkgs system property (using a vertical bar as a separator), the JVM will look for a conventionally named class extending URLStreamHandler, and you can define this class to return a stream connected to an arbitrary data source. In contrast to a servlet, any URL based on such a protocol will be meaningless outside of the local JVM. On the other hand, it can be convenient to have everything happening in the same thread (which is not the case with a servlet). Javasoft carefully hides the documentation of this feature under one of the URL constructors. You would look in vain in the URLStreamHandler documentation for any hint of how to make the JVM aware of a new Handler. http://www.javasoft.com/products/jdk/1.2/docs/api/java/net/URL.html#URL(java .lang.String, java.lang.String, int, java.lang.String, java.net.URLStreamHandler) -----Original Message----- From: Keith Visco [mailto:kvisco@exoffice.com] Sent: Monday, May 08, 2000 7:03 PM To: xalan-dev@xml.apache.org Subject: Re: extension questions You should put your Database code in a servlet if you can, which is accessible via a URL call. This will allow you to continue to just use the document() function and allow you to remain compatible with the XSLT spec. --Keith Jeff Cutler-Stamm wrote: > > i'm not garaunteed to have a URL. my document is the result of some internal > processing which might involve accessing another URL or a database of some > kind but my extension is the thing that actually needs to create the DOM. > one method I tried was: > > XSLTEngineImpl.setSourceDocument( "myFakeUrl", myDomTree ); > > in my extension and then used document("myFakeUrl") in the stylesheet but > that didn't seem to work (e.g. select="document('myFakeUrl')" /> returns nothing whereas if you give > document() a file system path to an XML file it does work. The javadoc > indicates that setSourceDocument() adds the Url->Document mapping to a table > so that the next time it is requested, that Document object is used rather > than the Url being evaluated again but this doesn't seem to be working. > > regards, > jeff > > > > > You could just use the document() function if you just have a URL. > > > > --Keith > >