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,
inPath);
StringBuffer sb = new StringBuffer();
for (int i=0; i< df.getChildNodes().getLength(); i++) {
sb.append(df.getChildNodes().item(i).getNodeValue());
sRet = sb.toString();
}
if (sm != null) {
cm.release((Component)sm);
}
} catch (Throwable e) {
System.out.println("getParAut - Errore "+e);
}
finally {
cm.release((Component)sm);
}
return sRet;
}
<xsp:logic>String sSoc = getParAut("authentication",
"/authentication/data/socOM");</xsp:logic>
<outEasy sizeFont="3" label="Codice Societa':" alignLabel="left"
widthLabel="100"
alignCampo="left" widthCampo="100" name="codiceSoc"
size="5">
<xsp:attribute
name="value"><xsp:expr>sSoc</xsp:expr></xsp:attribute>
Please let me know what you think about.
Thanks a lot
Flavio
>-- Original Message --
>Reply-To: [EMAIL PROTECTED]
>Date: Mon, 02 Feb 2004 21:05:29 +0100
>From: Joerg Heinicke <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>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"
mean?
> this works
> <p>
> codice societa':<session:getxml context="authentication"
> path="/authentication/data/socOM"/>;
> </p>
Have
>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
>cOM"/></xsp:attribute>
> </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
obvious.
Joerg
--------------------------------------------
>------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]