You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sharief Chandler <sh...@redknee.com> on 2001/06/08 01:09:09 UTC

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 &lt;select&gt; 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.
sharief@redknee.com
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: My HTML tags in XML page are escaped

Posted by Antonio Parolini <to...@employer.com.br>.
> more elegant ???
> you mean the first ??
> the first is also compatible with c2 and not the second

mmm... that's true,

But I think you could return a XMLFragment instead of a DOM Nodes, and stay
C2 forwad compatible.

Let's stay elegant!


- Tony

>
>
> 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:sharief@redknee.com]
> > Sent: Friday, June 08, 2001 1:09 AM
> > To: cocoon-users@xml.apache.org
> > 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 &lt;select&gt; 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.
> > sharief@redknee.com
> > 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: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> >
> > ---------------------------------------------------------------------
> > 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: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: My HTML tags in XML page are escaped

Posted by fo...@neonics.com.

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:sharief@redknee.com]
> > Sent: Friday, June 08, 2001 1:09 AM
> > To: cocoon-users@xml.apache.org
> > 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 &lt;select&gt; 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.
> > sharief@redknee.com
> > 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: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> > 
> > ---------------------------------------------------------------------
> > 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: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> 
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: My HTML tags in XML page are escaped

Posted by Samuel ARNOD-PRIN <sa...@smile.ch>.
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:sharief@redknee.com]
> Sent: Friday, June 08, 2001 1:09 AM
> To: cocoon-users@xml.apache.org
> 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 &lt;select&gt; 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.
> sharief@redknee.com
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: My HTML tags in XML page are escaped

Posted by Jaroslaw Kutylowski <JK...@axit.pl>.
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:sharief@redknee.com]
Sent: Friday, June 08, 2001 1:09 AM
To: cocoon-users@xml.apache.org
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 &lt;select&gt; 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.
sharief@redknee.com
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>