cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Flavio Palumbo" <>
Subject Re: problem with getxml
Date Mon, 02 Feb 2004 21:24:34 GMT
Hi Joerg,

i found this strange behaviour : 

the content of the fragment at /authentication/data/socOM in the context
authentication contains the code "8801", and i can see this value if i show
on screen with first snippet.

I thought that i could evaluate a variable in the same manner (second snippet)
; but this doesn't happen.

Anyway, looking at the mail archive, i found some interesting examples and
i wrote a little function that seems to work ; here is the code :

      private synchronized String getParAut(String inContext, String inPath)

         String sRet = null;
         org.apache.avalon.framework.component.ComponentManager cm = this.manager;
         org.apache.cocoon.webapps.session.SessionManager sm = null;

         //System.out.println("getParAut - cerco **"+inPath+"** in **"+inContext+"**");
         try {
             sm = (org.apache.cocoon.webapps.session.SessionManager)cm.lookup(org.apache.cocoon.webapps.session.SessionManager.ROLE);
             org.w3c.dom.DocumentFragment df = sm.getContextFragment(inContext,
             StringBuffer sb = new StringBuffer();
             for (int i=0; i&lt; df.getChildNodes().getLength(); i++) {
                  sRet = sb.toString();
             if (sm != null) {
         } catch (Throwable e) {
                 System.out.println("getParAut - Errore "+e);
	 finally {
         return sRet;

           <xsp:logic>String sSoc = getParAut("authentication", "/authentication/data/socOM");</xsp:logic>
           <outEasy sizeFont="3" label="Codice Societa':" alignLabel="left"
                     alignCampo="left" widthCampo="100" name="codiceSoc"
                     <xsp:attribute name="value"><xsp:expr>sSoc</xsp:expr></xsp:attribute>

Please let me know what you think about.

Thanks a lot


>-- Original Message --
>Date: Mon, 02 Feb 2004 21:05:29 +0100
>From: Joerg Heinicke <>
>Subject: Re: problem with getxml
>On 31.01.2004 21:48, Flavio Palumbo wrote:

> Hi all,
> i got a strange problem using getxml ; if i try to use it only to display
> the content of the fragment everything is fine, but if i try to evaluate
> a variable
> with the same code it 
>oesn't work. Here is the code :

Not that I'm familiar with session:getxml, but what does "doesn't work"


> this works
> <p>
>   codice societa':<session:getxml context="authentication" path="/authentication/data/socOM"/>;
> </p>

>a look at the output code: Does session:getxml return an element or 
just text?

> this doesn't work
> <parameter name="test">
>   <xsp:attribute name="value"><session:getxml as="string" context="authentication"
> path="/authentication/data/s
> </parameter>

Try to put it not into an attribute, maybe that's the problem. You can 
also have a look into the resulting Java code. Maybe there it is more 


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message