You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chitharanjan Das <cd...@accordiasys.com> on 2002/04/04 00:04:56 UTC

Urgent: Requirement - Ability to extract o/p from resources - SunShine developers - please peruse this and provide comments

Hello All,


I have the following requirement ....................

I have created a set of pipelines (resources) that execute a set of
logic and spit out XMLs (results)

Now What I want is that somehow get hold of that XML as  a String and do
further manipulations like sending the result to another pipeline for
instance.


To be more illustrative:

The resources are
	1. Validate Item
		<map:match pattern = "validateItem >
			.....
		</map>
	2. Is present in Inventory
		<map:match pattern = "InventoryCheck" >
			....
		</map>
	3. GetPrice
		<map:match pattern = "priceValidate" >
			....
		</map>


In a XSP or an action , I would like to do the following
	Parameters.setParameter("itemId",itemId);
	DocumentFragment item =
resource.getXMLData("validateItem",parameters);
	String itemXML = getXMLStringFromDocumentFragment(item);

	If(validate(itemXML) {
		DocumentFragment inventoryItem =
resource.getXMLData("InventoryCheck ",parameters);
	}
	else 
		reportItemInvalid(
	and so on ...........


Also I could use the above resources in pipelines using map:call to
generate html o/p



I am not talking in the blind here,
	The sunshine developers use this mechanism in authenticating a
user, creating a new user and so on..
  But their code is centric on using sunshine Component.

I was wondering, is there a standard way of doing this and is it
documented some place.

Thanks in advance,
Chiths





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Followup: Urgent: Requirement - Ability to extract o/p from resources - SunShine developers - please peruse this and provide comments

Posted by Chitharanjan Das <cd...@accordiasys.com>.
The following XSP code snippet, does the required ..
However, this is an implementation of the sunrise component.
Which does not implement cocoon:/ (cocoon Relative URI)

<xsp:logic>
		ResourceConnector resourceConnectorComponent = null;
		 try {
		      resourceConnectorComponent =
(ResourceConnector)
	
this.manager.lookup(ResourceConnector.ROLE);
		     } catch (ComponentException ce) {
		       throw new ProcessingException("Error during
lookup of 					sunShine resource
connector.", ce);
            }
	    	String uri = "cocoon://prd/xsp/test/links";
    		Resource resource = new Resource(resolver, uri);
	    	String data = null;
    		System.out.println("resource is "+resource);
	    	if(resource != null) {
    			data =
resourceConnectorComponent.getContent(
				resource.getResourceType(),
parameters,resource.getResourceIdentifier(),
				parameters);
	//
    		System.out.println("Data is :"+data); 
    	}
</xsp:logic>

Is there any provision in the Basic Cocoon package to do this
functionality ....

Regds,
Chiths

-----Original Message-----
From: Chitharanjan Das [mailto:cdas@accordiasys.com] 
Sent: Wednesday, April 03, 2002 2:05 PM
To: cocoon-users@xml.apache.org
Subject: Urgent: Requirement - Ability to extract o/p from resources -
SunShine developers - please peruse this and provide comments


Hello All,


I have the following requirement ....................

I have created a set of pipelines (resources) that execute a set of
logic and spit out XMLs (results)

Now What I want is that somehow get hold of that XML as  a String and do
further manipulations like sending the result to another pipeline for
instance.


To be more illustrative:

The resources are
	1. Validate Item
		<map:match pattern = "validateItem >
			.....
		</map>
	2. Is present in Inventory
		<map:match pattern = "InventoryCheck" >
			....
		</map>
	3. GetPrice
		<map:match pattern = "priceValidate" >
			....
		</map>


In a XSP or an action , I would like to do the following
	Parameters.setParameter("itemId",itemId);
	DocumentFragment item =
resource.getXMLData("validateItem",parameters);
	String itemXML = getXMLStringFromDocumentFragment(item);

	If(validate(itemXML) {
		DocumentFragment inventoryItem =
resource.getXMLData("InventoryCheck ",parameters);
	}
	else 
		reportItemInvalid(
	and so on ...........


Also I could use the above resources in pipelines using map:call to
generate html o/p



I am not talking in the blind here,
	The sunshine developers use this mechanism in authenticating a
user, creating a new user and so on..
  But their code is centric on using sunshine Component.

I was wondering, is there a standard way of doing this and is it
documented some place.

Thanks in advance,
Chiths





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>