Title: RE: How to append a xml string as content

Sorry, but I donīt understand.
Wich parser should I use and how should I use it ?

I'm trying this that used to work in Cocoon 1 but it's not working here:

<!-- Version:   @version $Id: terminos.xsp,v 1.5 2002/10/11 13:50:28 slombardozzi Exp $ -->

<xsp:page
          language="java"
          xmlns:xsp="http://apache.org/xsp"
>

        <xsp:structure>
                <xsp:include>ar.com.technisys.ccm.servidor.Registro</xsp:include>
                <xsp:include>ar.com.technisys.util.DOMUtils</xsp:include>
                <xsp:include>org.w3c.dom.Document</xsp:include>
        </xsp:structure>

        <pagina>               
                <xsp:logic>
                        String usuario = request.getParameter("usuario");
                        String operador = request.getParameter("operador");
                        String texto = null;
                        System.err.println("Hola");
                        try{
                                texto = Registro.getUltimoRegistro(usuario,operador);
                        }
                        catch (Exception e){
                                e.printStackTrace();
                        }
                </xsp:logic>
                <contenido>
                        <usuario><xsp:expr>usuario</xsp:expr></usuario>
                        <operador><xsp:expr>operador</xsp:expr></operador>
                        <texto>
                        <xsp:logic>
                        System.err.println("Hola2");
                        try {
                                Document doc = DOMUtils.parse(texto);
                                System.err.println("Hola3");
                                System.err.println("El doc es "+doc);
                                <xsp:content><xsp:expr>doc.getFirstChild()</xsp:expr></xsp:content>
                        }
                        catch (Exception e) {
                                e.printStackTrace();
                        }
                        </xsp:logic>
                        </texto>
                </contenido>
        </pagina>
</xsp:page>

Help me please !!

-----Mensaje original-----
De: J.Pietschmann [mailto:[EMAIL PROTECTED]]
Enviado el: Jueves, 17 de Octubre de 2002 05:38 p.m.
Para: [EMAIL PROTECTED]
Asunto: Re: How to append a xml string as content


Alejandro Raiczyk wrote:
> Registro.getUltimoRegistro returns a xml string like
> "<log><inicio>243543254325</inicio><fin>23485845</fin></log>", the
> thing is that I donīt want to treat that string as a string, I want it
> to form part of the xml content of my page, so I can apply a XSL to
> it, any ideas ?

If it's well wormed XML as in your example, run it through an XML parser. I'm not sure whether this would work in a XSP, but you can put it in special element and use a custom transformer in the next pipeline stage matching this element. Another possibility is to write a custom generator and aggregate it's output to the rest of the data.

J.Pietschmann


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

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to