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: do not quote!
Date Thu, 06 Jul 2000 13:02:18 GMT
did you already solve your problem with converting an "xml-string" into a
node-set?

if  so, please let me know...

I tried the following:

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

but

Torsten Curdt wrote:

> > > String Result = "<mytag>stuff</mystuff>";
> >
> > First of all, your tags are not well-formed.
>
> ups... in the source it's well-formed ;-)
>
> > > But unfortunately this only gives the
> > > result quoted and it gets not involved
> > > in the matching process.. what I want
> > > is something like
> > The String is treated as a text node, so it's never parsed into
> > an XML node.
> > Also, <xsp:expr> translates objects to strings from its toString() method,
> > and ultimately text nodes, so even if you returned any other object, it
> > would end up as a text node.
>
> Hm... so there's no way of returning something that goes back into
> the XML parsing process?! :-(
>
> > I believe what you want to do is return a Node object and include it using
> > <xsp:logic> and the xspCurrentNode object:
>
> Well, I want to add some child nodes to the current node
> and -if possible- let cocoon do the parsing job!
> But now I fear the parsing has already happened at that time...
> Right?!
>
> > <xsl:template match="listing">
> >     <xsp:logic>
> >         xspCurrentNode.appendChild(getResult(document));
> >     </xsp:logic>
> >     <xsl:apply-templates/>
> > <xsl:templates>
> >
> > Note that you either have to create the Node using the same
> > document element
> > (that's why the method is passed the document object) or use the
> > XSPUtils.cloneNode() method.
>
> Hm.. why should I pass the document object to my method?!
> What is the parameter of appendChild ?
>
> > Of course, you could parse the String that is
> > returned, but that would be substatialy slower.
>
> Any idea how I can include external xml data as fast
> as possible ?! (maybe passing a tree instead of a string
> and add a complete subtree instead of each child?!)
> --
> 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