Use this function in your xsp page for cocoon2:
private void parse(String data) {
try
{
InputSource __is = new InputSource( new StringReader(data));
org.apache.cocoon.components.parser.Parser newParser =
(org.apache.cocoon.components.parser.Parser)
this.manager.lookup(Roles.PARSER);
XSPUtil.include(__is, this.contentHandler, newParser);
} catch (Exception e) {
// some logging function here
}
}
or this one for c1
private Node parse( String data ) {
try
{
return xspParser.parse(
new InputSource(new StringReader
(data))).getDocumentElement();
}
catch( Exception e )
{
// some logging here
log.error("parse(): "+e.getMessage());
return null;
}
}
If you want to check for c1 or c2, take a look at the xsp:util logicsheet,
it defines some variables indicating which environment (c1 or c2) you
are in. You can use that to distinct between the two parse functions.
You use the parse function like this:
<xsp:logic>
parse(someFunctionReturningAnXMLString());
</xsp:logic>
> more elegant ???
> you mean the first ??
> the first is also compatible with c2 and not the second
>
>
> Jaroslaw Kutylowski a écrit :
> >
> > There are 2 possibilities for you (as always :)). The first is you use the
> > <util:include-expr><util:expr>mymethod()</util:expr> </util:include-expr>
> > which automatically converts a string that contains html/xml tags into a DOM
> > structure or, the better way,
> > you make a function that directly outputs a DOM Node.
> >
> > The choice is yours, but we encourage you to use the second, more elegant,
> > method.
> >
> > Jaroslaw Kutylowski
> > AxIT Poland
> >
> > -----Original Message-----
> > From: Sharief Chandler [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 08, 2001 1:09 AM
> > To: [EMAIL PROTECTED]
> > Subject: My HTML tags in XML page are escaped
> >
> > When I type:
> > ......
> >
> > <xsp:content>
> > <xsp:expr>
> > myHtmlAsStringMethod()
> > </xsp:expr>
> > </xsp:content>
> >
> > ...
> >
> > The page will actually show <select>...
> >
> > and when I view source it shows <select> in my page.
> >
> > How do I get the returned string of HTML tags to become a part of my page?
> >
> > Sharief
> >
> > Sharief Chandler
> > REDKNEE Inc.
> > [EMAIL PROTECTED]
> > Phone: +19056255072
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>