XSP

X-Application Version: 3.1.2, 3.1.1
Tamino Version : 3.1.1
Platform : NT, Win2k, Solaris, …
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

Hi everybody

is there any plan for future of xapplication thru XSP:D concept.



Hi,

i’m a student currently doing my thesis at Software AG. My subject ist to investigate, whether and how
X-Application and Cocoon can be used together.
I would like to ask you some questions, just to be certain that we talk about the same things:
- Are you talking about Cocoon eXtensible Server Pages (XSP)?
- If yes, do you want to integrate Cocoon and X-Application? (there are many ways to do this…)

If your question is not related to Cocoon, I’m sorry that I am not the right one to talk to…

Mathias Guettler

Yes i am interesting in Cocoon.
Currently we using JSP based development. TAG lib and scriplets are very good but i think it is not ideal.Some times i think it is a spaghetti. Because of “XspNodeStack” and Logicsheet and more XSP concept will be next flash.

If you have some solution or information i am ready to listen.

Thanks
Brgs

Hi,

just to answer your original question:
- no, there is no attempt to develop a XSP taglibrary for Cocoon
(like X-Application taglib forJSP)


I see three basic methods to access Tamino from Cocoon:
- URL (access of response documents by URL)
- Java API (used in Cocoon XSP)
- JSP (Cocoon JSP Generator)

URL:
Instead of using file based XML documents,
you can use Tamino Command syntax to create an URL that
requests a response document from Tamino.
The response document can be formatted by XSL stylesheet transformation.
I suppose this approach is best for publishing and simple queries,
it’s not suitable for form based applications.
Disadvantage:
- only whole documents can be accessed;
- write access (create and update) is difficult to manage

Java API:
There are three API’s that allow access to Tamino:
- X-Application aPI
- Tamino API
- XML:DB API
I suggest you would use X-Application API instead of Tamino API,
because it’s more comfortable.
Also of interest is XML:DB, because it offers a generic way
to access XML databases(i.e. Xindice).

JSP:
You are free to build your own JSP-Pages and use them with Cocoon.
Although it looks like there is no advantage to common JSP,
there is a difference (or actually could be).
The idea is to strip all HTML code from the JSP and add HTML Code later by a XSL stylesheet.
This would result in a better separation of content and presentation.
In the best case you have one XSL stylesheet for your application,
and many JSP’ with a minimum of content.
This method will be investigated, at the moment it’s simply an idea.

From Cocoon point of view I would prefer XML:DB,
beacuse it’s generic, portable and an open standard.
(a generic XSP Taglib for XML:DB interface seems a good idea to me)

If you are free to choose a framework
and want to build small, standalone webclients for a Tamino Database
I would recommend that you use Struts with X-Application API.

I you are interested in any of my suggestions, you can contact me for assistance.


regards

Mathias

Dear Mathias,

I am planing to use XSP concept prior for Dynamic Complex Queries.

So could you give me some more tips for two API’s
- X-Application aPI
- XML:DB API

Do you think i can handle to get which occurance of node will fit my query criteria.

And you think i will join different oc type’s in a XSP(After LogicSheet as XML) result before XSLT.

Brgs

Hi,

first a link that can help to get XML:DB running.
http://www.cocooncenter.de/cc/documents/resources/xindice/index.html
It’s concerned with the XML:DB driver of Xindice but it works with Tamino XML:DB the same way.

If you are interested to get Cocoon working with X-Application (Taglib and API) and XML:DB
then I can send you some ideas in detail what it needs and what to to (I think that’s too much for here).

To your answer your questions:
- I am not very experienced in X-App API,
so I fear I cannot help you with that.

Can’t you simply chain several search parameters in X-Path i.e. like this Tamino URL example:
http://localhost/tamino/WebApplications/RealEstate?_xql=/Property[//Country=‘USA’%20and%20//@Category=‘Buy’]

As far as I know you can chain search parameters in X-Path if you are going to make a direct query to Tamino with X-App.
You cannot chain parameters if you refer to a query result that is stored in X-Application, because X-App does not fully support X-Path.

- concerning the second question
do you have an example?

could this eventually touch your problem?? :
you can concatenate two pipelines by using “internal” pipelines. Each pipeline gets a different occurence by using the API (i.e. different doctypes).

Pipeline 1(internal): XSP(generator)->XML(serializer)
Pipeline 2(internal): XSP(generator)->XML(serializer)
Pipeline 3: XML(aggregator of Pipeline1 and Pipeline2)->XSLT(transformer)->HTML(serializer)

the output of both XSP is Chained to a single XML document which can be transformed by XSLT…
See Cocoon FAQ at http://xml.apache.org/cocoon/faq/faq-sitemap.html#faq-4 for an example.

Send me a mail, if you need the installing instructions…

regards

Mathias

[This message was edited by Tao Baibai on 11 Jul 2002 at 17:54.]

Hi,

after got X-Application API and Cocoon working together, I would recommend you to check out the XSP Cocoon examples at
%TOMCAT_HOME%\webapps\Cocoon\docs\samples\xsp

and to check the X-Application java examples at
%xapplication_312_directory%\examples\API\src\com\softwareag\xtools\xapplication\examples\API\property

to go further

Dear mathias,

Now everything works.

I defined pipelines and everyting . Now could you send me how i can access tamino db in XSP what is the tag sysntax.

Do you have any sample


map:pipeline
<map:match pattern=“tamino-xmldb-test”>
<map:generate src=“xmldb:tamino://localhost/tamino/CAPA/xapp311/”/>
<map:serialize type=“xml”/>
</map:match>
</map:pipeline>


Brgs

Hi,

I suppose from your post that you intend to use XM:DB API instead of X-Application API.
The way you use that API should be similar to X-Application (I think X-Application is more comfortable).

just to be sure to you understand you correctly:
the pipline fragment:
<map:generate src=“xmldb:tamino://localhost/tamino/CAPA/xapp311/”/>
is suitable for testing Tamino XML:DB Driver(because it simply gets a response document from Tamino and puts it into the XML generator; you could do the same using an appropriate URL with Tamino; I failed to do further queries with it)
As result you will get an collection statistic: Tamino-Database: CAPA; Collection: xapp311
which look like that:

<?xml version="1.0" encoding="UTF-8" ?>
<collection:collections resources=“41” collections=“0” xmlns:collection=“http://apache.org/cocoon/xmldb/1.0” />

The "resources=“41” is the number of documents in the collection.
If that produces an error the driver is not working properly.
The cause could be a wrong combination of jarfiles(xerces & xalan version), a wrong entry in cocoon.xconf, missing database or collection etc.


From that point you can use the XML:DB API in XSP’s.
As I understand it, you can use Java code in a XSP Taglib (i.e.ESQL) by using the tags that are exposed by the registration of that Taglib. As far as I know there is no standard Taglib concerning XML:DB, that means you that you have to imlement your own Taglib using the XML:DB API (see documentation at http://www.xmldb.org/).
(I think XSP taglibs are equivalent to JSP Taglibs)

Another way to use Javacode is to put it to XSP directly like most the XSP examples of Cocoon.
(that’s like using Java Code in JSP scriplets)

I’m sorry that have no example for that. I suggest that you search for:
- examples with Cocoon and Xindice (it’s the same thing with Cocoon and Tamino using XML:DB)
- news concerning Cocoon development (perhaps there is someone out there writing that XSP Library)
- examples of XML:DB API

regard
Mathias
X-Application Version: 3.1.2, 3.1.1
Tamino Version : 3.1.1
Platform : NT, Win2k, Solaris, …
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

[This message was edited by Tao Baibai on 18 Jul 2002 at 10:37.]

Hi,

I had a closer look to the XML:DB Spezification:
at http://www.xmldb.org/xapi/xapi-draft.html#CoreLevel0

The XML:DB driver for Tamino currently supports “Core level 1 functionality”.

That means that you can do queries with X-Path but you cannot do any update (you need “XUpdateQueryService” support to do updates which is not included in Core Level 1).

regards

Mathias

[This message was edited by Tao Baibai on 18 Jul 2002 at 15:36.]

Dear Matias thanks for your info. It realy fits my solution. Now i am
planning to use cocoon query purpose.

How can i use xapplication API from xsp ,
Should i define a taglib(LogicSheet) or should i use direct java calls could you give
me any small example on XSP

If you have any example XMLDB or Xapllication written on XSP or/and Logic sheet could you please send me.

Brgs

Dear Matias ,

I definitly decide to use xmldb API. So eXist and Xindice have alot of smaple and information xmldb API.

For Tamino do you have any link or resource.

Check this site. It is an XMLDB API plugin. And it says it can implement tamino. Not only core level 1.

Brgs

Dear Matias ,

I definitly decide to use xmldb API. So eXist and Xindice have alot of smaple and information xmldb API.

For Tamino do you have any link or resource.

Check this site. It is an XMLDB API plugin. And it says it can implement tamino. Not only core level 1.

http://www1.ktaland.com/docs/xmlBlaster/html/XMLDBPlugin_8java-source.html

Brgs

Dear Matias ,

After last week work i got the concept , and i like it. Then i decide to use following logic.

1-) I will use xmdbapi ( at the begining i will use query purpose only) at the future xmldbapi will be unique(like jdbc,odbc)

2-) I will create my taglibrary from xapplication tag library . For this one i will create logicsheet template by using helper classese.

3-) So implementing query logicsheet ;

During multiphase XSLT i will work base on businessDocument or/and set of Businessdocuments .
Do you think in which state i will concentrate one BusinessDocument Concept(Single Document type for query result). I think it should be done on begining of second phase (After logic sheet) during XSP processing(Before XSLT).

This logic let you n to n logic sheet and style sheet matching for the same data source.


Thanks for your help , and if you have some sample on logic sheet xmldbapi , and any tips waiting your message.

Brgs
:smiley:

Dear Matias ,

I got a test definition on sitemap.xmap


<map:match pattern=“xmldb/">
<map:match pattern=“xpath” type=“request-parameter”>
<map:generate src=“xmldb:xindice://localhost:4080/db/{…/1}#{1}”/>
<map:serialize type=“xml”/>
</map:match>

<map:generate src=“xmldb:xindice://localhost:4080/db/{1}”/>
<map:serialize type=“xml”/>
</map:match>


<map:match pattern="ino/
”>
<map:generate src=“xmldb:tamino://localhost/tamino/CAPA/xapp311/Property”/>
<map:serialize type=“xml”/>
</map:match>

but when i try to test it i got following exception

Cocoon 2 - Internal server error

--------------------------------------------------------------------------------

type fatal

message Could not read resource xmldb:tamino://localhost/tamino/CAPA/xapp311/Property

description org.apache.cocoon.ProcessingException: Could not read resource xmldb:tamino://localhost/tamino/CAPA/xapp311/Property: org.xmldb.API.base.XMLDBException: Collection=xapp311, DocType=temp, ino:id=Property

sender org.apache.cocoon.servlet.CocoonServlet

source Cocoon servlet

stack-trace

org.apache.cocoon.ProcessingException: Could not read resource xmldb:tamino://localhost/tamino/CAPA/xapp311/Property: org.xmldb.API.base.XMLDBException: Collection=xapp311, DocType=temp, ino:id=Property
at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:156)
at org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEventPipeline.java:250)
at org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:399)
at org.apache.cocoon.www.sitemap_xmap.matchN10417(www\sitemap_xmap.java:4819)
at org.apache.cocoon.www.sitemap_xmap.process(www\sitemap_xmap.java:3323)
at org.apache.cocoon.www.sitemap_xmap.process(www\sitemap_xmap.java:3130)
at org.apache.cocoon.sitemap.Handler.process(Handler.java:224)
at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179)
at org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154)
at org.apache.cocoon.Cocoon.process(Cocoon.java:575)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:999)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
org.xmldb.API.base.XMLDBException: Collection=xapp311, DocType=temp, ino:id=Property
at com.softwareag.tamino.xmldb.API.base.TCollection.getResource(TCollection.java:686)
at org.apache.cocoon.components.source.XMLDBSource.resourceToSAX(XMLDBSource.java:239)
at org.apache.cocoon.components.source.XMLDBSource.toSAX(XMLDBSource.java:224)
at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:143)
at org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEventPipeline.java:250)
at org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:399)
at org.apache.cocoon.www.sitemap_xmap.matchN10417(www\sitemap_xmap.java:4819)
at org.apache.cocoon.www.sitemap_xmap.process(www\sitemap_xmap.java:3323)
at org.apache.cocoon.www.sitemap_xmap.process(www\sitemap_xmap.java:3130)
at org.apache.cocoon.sitemap.Handler.process(Handler.java:224)
at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179)
at org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154)
at org.apache.cocoon.Cocoon.process(Cocoon.java:575)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:999)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)


request-uri

/cocoon/ino/Property

path-info

ino/Property

--------------------------------
What is the problem , how can i assign doctype .

Brgs

Hello,

I have no knowledge about XML-DB drivers. I have seen your requets URI

//localhost/tamino/CAPA/xapp311/Property

within your last error message.

Perhaps, the URI for the document is not complete. URI for a certain document would look like this:

http://localhost/tamino/CAPA/xapp311/Property/@x

where ‘x’ is the ino:id of your document, e.g.

http://localhost/tamino/CAPA/xapp311/Property/@25

Your database name is ‘CAPA’ and ‘xapp311’ the collection name and Property the doctype of your document.

The collection was recognized correctly, but the output for doctype and ino:id was surprising for me.

“Collection=xapp311, DocType=temp, ino:id=Property”

Bye,
Christian.

Dear Christian,

XMLDB seems alitle bit different. When i try i got this error

------------------------------------------------------------------
Cocoon 2 - Internal server error

--------------------------------------------------------------------------------

type fatal

message Could not read resource xmldb:tamino://localhost/tamino/CAPA/xapp311/Property/@1

description org.apache.cocoon.ProcessingException: Could not read resource xmldb:tamino://localhost/tamino/CAPA/xapp311/Property/@1: org.xmldb.API.base.XMLDBException: Access Failure: ReturnValue:8811 Code:INOXRE8811 MessageText:Collection name not found MessageLine:Collection name = xapp311.Property

sender org.apache.cocoon.servlet.CocoonServlet

source Cocoon servlet

stack-trace

org.apache.cocoon.ProcessingException: Could not read resource xmldb:tamino://localhost/tamino/CAPA/xapp311/Property/@1: org.xmldb.API.base.XMLDBException: Access Failure:
ReturnValue:8811
Code:INOXRE8811
MessageText:Collection name not found
MessageLine:Collection name = xapp311.Property


-----------------------------------------------------
So we could not get any tamino xmldb API sample at net. But for eXsit and Xindice there are some samples but not good.

So it an example from Xindice that applied to Tamino By Matias. May be you can give me a trick about ino:docname
<?xml version="1.0" encoding="UTF-8"?>








then
it is told it works

src=“xmldb:tamino://localhost/tamino/welcome3_1_1_1/xapplication312#Property
/prop1”/>

Brgs

Hi,

I see no way to do queries that way (with XML:DB). There are some Xindice Examples for Cocoon (Sitemap) where this is supposed to work, but I could not reproduce that for Tamino XML:DB.

A statement I got and which I agree pointed out
that:
“The architecture for our XML:DB driver is that it “sits on top of” Tamino API for Java. (Meaning that it is using the Tamino API for Java internally.)
So it isn’t possible to perform a query directly to Tamino using an XML:DB style URI. The XML:DB driver must be used - which also means that the XPathQueryService must be used to perform an XPath query.

The most direct way of retrieving an instance through the XML:DB API is to use Collection.getResource().

The JavaDoc of that method is at:
http://www.xmldb.org/xapi/API/org/xmldb/API/base/Collection.html

The XPath query to return instances of Property that have CA as their State is: /Property[Address/State=“CA”]
The best place to look for example queries is the Tamino documentation, in:
C:\Program Files\Software AG\Tamino\Tamino 3.1.1.4\Help\XQL\XQLOVER.HTM


The Xindice documentation could provide you with some programming examples:
http://www.dbxml.org/docs/index.html

If you want to do queries that way it’s better that you use Tamino URL directly.

[This message was edited by Tao Baibai on 26 Jul 2002 at 10:15.]