cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans-Guenter Stein <Hans-Guenter.St...@siteos.de>
Subject Re: How to insert an xml-tree stored in a string?
Date Thu, 06 Jul 2000 13:11:18 GMT
I got it working but the solution is rather slow (see code below)

I wonder whether there is a solution that works a little faster. Any ideas??

    <xsp:logic>
     // the mysql.showTableXML returns a string containing
     // the contents of a table enclosed in xml-tags
     String out=mysql.showTableXML("spiele");
    </xsp:logic>

    <xsp:expr>
      this.xspParser.parse(
        new InputSource(
          new StringReader(
     String.valueOf(out)
          )
        )
      ).getDocumentElement()
    </xsp:expr>





Torsten Curdt wrote:

> > How to insert an xml-subtree generated via some Java-functions into an
> > xml-document?
> >
> > like:
> >
> >     <xsp:logic>
> >      String aaa = "<a><a1>this is a1</a1><a2>this is a2</a2></a>";
> >     </xsp:logic>
> >     <xsp:expr>aaa</xsp:expr>
> >
> > such that a subsequent processing instruction could work with the
> > inserted nodes
>
> That's exactly what I asked for in another thread.
> As far as I know now... You can't without parsing the
> String by yourself.
>
> You can
>
> 1)add a single node with "xspCurrentNode.appendChild()"
> 2)or add a tree you build up by yourself
> 3)or use use the cocoon parser to do so (I guess)
>
> See the XSPSqlLibary.java how it works...
> I'm trying on this, too, because I don't like
> the approach to have the sql string in my pages.
> I'm thinking of a bean doing this and giving back
> a tree which represents the query result.
> --
> Torsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message