You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2000/08/24 11:09:41 UTC

HTML Formatter problem

Hi Folks,

I asked this question on the Users list, with no reply, forgive me for the
X-Post.

I am trying to output valid XML, inside HTML. (The valid XML is going
inside a <textarea/>, so it can be edited and posted back to the server, as
valid XML).

The XML sometimes includes Tags like <li>List Item</li>, The HTML
Formatter, doing it's job properly, strips the ending </li> tag, producing
valid HTML, but breaking it as XML.

Is it possible somehow to tell the HTML Formatter to not format the
children of certain Element?

Thanks for any help

regards Jeremy

-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: [Cocoon Devel] HTML Formatter problem

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 24 Aug 2000, Rogerio Lacerda wrote:

> put in your XSL:
> 
> <xsl:output method="html"/>

you can't use the xsl:output elements in cocoon - it doesn't use Xalan to
do the serialization.

- donald


Re: [Cocoon Devel] HTML Formatter problem

Posted by Rogerio Lacerda <ro...@yahoo.com>.
put in your XSL:

<xsl:output method="html"/>




----- Original Message -----
From: Jeremy Quinn <je...@media.demon.co.uk>
To: Cocoon Dev <co...@xml.apache.org>
Sent: Thursday, August 24, 2000 10:09 AM
Subject: [Cocoon Devel] HTML Formatter problem


> Hi Folks,
>
> I asked this question on the Users list, with no reply, forgive me for the
> X-Post.
>
> I am trying to output valid XML, inside HTML. (The valid XML is going
> inside a <textarea/>, so it can be edited and posted back to the server,
as
> valid XML).
>
> The XML sometimes includes Tags like <li>List Item</li>, The HTML
> Formatter, doing it's job properly, strips the ending </li> tag, producing
> valid HTML, but breaking it as XML.
>
> Is it possible somehow to tell the HTML Formatter to not format the
> children of certain Element?
>
> Thanks for any help
>
> regards Jeremy
>
> --
>    ___________________________________________________________________
>
>    Jeremy Quinn                                           Karma Divers
>                                                        webSpace Design
>                                             HyperMedia Research Centre
>
>    <ma...@mac.com>     <http://www.media.demon.co.uk>
>     <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>
> _______________________________________________
> cocoon-devel mailing list
> cocoon-devel@lists.real-time.com
> https://mailman.real-time.com/mailman/listinfo/cocoon-devel


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: HTML Formatter problem

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 09:19 +0800 25/08/00, Niclas Hedhman wrote:
>Jeremy Quinn wrote:
>
>> At 03:12 -0700 24/08/00, Pier P. Fumagalli wrote:
>> >Jeremy Quinn wrote:
>> >> I am trying to output valid XML, inside HTML. (The valid XML is going
>> >> inside a <textarea/>, so it can be edited and posted back to the
>>server, as
>> >> valid XML).
>> Can anyone make any lateral suggestions for working around this problem?
>
>How about letting it output to escaped sequence and make a 'Text' to 'XML'
>conversion in the doPost() upon submittal??

Yes, I was thinking about this too ....

I was put off by the idea of having to find and replace any and every
entity that might get into that String, according to whatever encoding
someone might be using etc. Kind of put me off this approach. Specially
when you can supply any old entities of your own.

Don't tell me .... there's a standard Method for doing it ?

This makes me realise the next problem .... if someone wants to edit XML
data that contains Entity references, those references will get expanded
when FP parses their Document, won't they .... ? So they would be editing
and saving "expanded" XML, something they probably would not want .... is
it possible to get Xerces to parse a file without entity expansion?

Yuk!

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: HTML Formatter problem

Posted by Niclas Hedhman <ni...@bali.ac>.
Jeremy Quinn wrote:

> At 03:12 -0700 24/08/00, Pier P. Fumagalli wrote:
> >Jeremy Quinn wrote:
> >> I am trying to output valid XML, inside HTML. (The valid XML is going
> >> inside a <textarea/>, so it can be edited and posted back to the server, as
> >> valid XML).
> Can anyone make any lateral suggestions for working around this problem?

How about letting it output to escaped sequence and make a 'Text' to 'XML'
conversion in the doPost() upon submittal??

Niclas


Re: HTML Formatter problem

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 25 Aug 2000, Jeremy Quinn wrote:

> At 12:38 -0400 24/08/00, Donald Ball wrote:
> >> Can anyone make any lateral suggestions for working around this problem?
> >
> >yeah - patch the HTMLFormatter to allow unescaped XML inside textareas
> >that have some magic attribute. not a very elegant solution, but i can
> >think of worse things
> 
> That is probably going to be the solution ..... I'll look into it
> Now, where is the "work" done? In
> org.apache.xml.serializer.HTMLSerializer.java right?

probably in the xerces serializer classes, actually.

- donald


RE: HTML Formatter problem

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 09:38 -0400 25/08/00, Vadim Gritsenko wrote:
>> >yeah - patch the HTMLFormatter to allow unescaped XML inside textareas
>> >that have some magic attribute. not a very elegant solution, but i can
>> >think of worse things
>
>Jeremy, If you want just to output XML/HTML/... inside <textarea>,
>why don't you just replace '<' and '>' with '&lt;' and '&gt;' :
>
><textarea name="blah">
>	&lt;li&gt;List Item&lt;/li&gt;
></textarea>
>
>Or is there any other problems with this?

I did not try this, because I did not know if it would convert back to XML
again properly by just parsing it. I really should have tried this before
bugging people !


regards jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

RE: HTML Formatter problem

Posted by Vadim Gritsenko <vg...@hns.com>.
> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> Sent: Friday, August 25, 2000 5:27 AM
> To: cocoon-dev@xml.apache.org
> Subject: Re: HTML Formatter problem
> 
> >yeah - patch the HTMLFormatter to allow unescaped XML inside textareas
> >that have some magic attribute. not a very elegant solution, but i can
> >think of worse things

Jeremy, If you want just to output XML/HTML/... inside <textarea>,
why don't you just replace '<' and '>' with '&lt;' and '&gt;' :

<textarea name="blah">
	&lt;li&gt;List Item&lt;/li&gt;
</textarea>

Or is there any other problems with this?


> That is probably going to be the solution ..... I'll look into it
> Now, where is the "work" done? In
> org.apache.xml.serializer.HTMLSerializer.java right?
> 
> What do you think would be the best thing to do, patch this part 
> of Xerces,
> or subclass HTMLSerializer.java to make "AdaptableHTMLSerializer" or
> something out of it.
> 
> If I can work out how to do any of this ..... what would be a suitable
> attribute to use, to trigger temporary XHTML output within HTML output?
> 
> 	<textarea name="blah" format="xml">
> 		<li>List Item</li>
> 		<img src="thang.gif"/>
> 	</textarea>
> 
> Or is there a more sophisticated attribute name I should use?
> 
> Thanks
> 
> regards Jeremy

Sincerely,
Vadim


Re: HTML Formatter problem

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 12:38 -0400 24/08/00, Donald Ball wrote:
>> Can anyone make any lateral suggestions for working around this problem?
>
>yeah - patch the HTMLFormatter to allow unescaped XML inside textareas
>that have some magic attribute. not a very elegant solution, but i can
>think of worse things

That is probably going to be the solution ..... I'll look into it
Now, where is the "work" done? In
org.apache.xml.serializer.HTMLSerializer.java right?

What do you think would be the best thing to do, patch this part of Xerces,
or subclass HTMLSerializer.java to make "AdaptableHTMLSerializer" or
something out of it.

If I can work out how to do any of this ..... what would be a suitable
attribute to use, to trigger temporary XHTML output within HTML output?

	<textarea name="blah" format="xml">
		<li>List Item</li>
		<img src="thang.gif"/>
	</textarea>

Or is there a more sophisticated attribute name I should use?

Thanks

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: HTML Formatter problem

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 24 Aug 2000, Jeremy Quinn wrote:

> At 03:12 -0700 24/08/00, Pier P. Fumagalli wrote:
> >Jeremy Quinn wrote:
> >> I am trying to output valid XML, inside HTML. (The valid XML is going
> >> inside a <textarea/>, so it can be edited and posted back to the server, as
> >> valid XML).
> >
> >If the HTML formatter is still the one I wrote... Hmmm no, it's not
> >possible...
> >
> >	Pier
> 
> Oh Dear,
> 
> That pretty much blows making a web IDE out of Cocoon! ....
> 
> Nasty business .....
> 
> Can anyone make any lateral suggestions for working around this problem?

yeah - patch the HTMLFormatter to allow unescaped XML inside textareas
that have some magic attribute. not a very elegant solution, but i can
think of worse things

- donald


Re: HTML Formatter problem

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 03:12 -0700 24/08/00, Pier P. Fumagalli wrote:
>Jeremy Quinn wrote:
>> I am trying to output valid XML, inside HTML. (The valid XML is going
>> inside a <textarea/>, so it can be edited and posted back to the server, as
>> valid XML).
>
>If the HTML formatter is still the one I wrote... Hmmm no, it's not
>possible...
>
>	Pier

Oh Dear,

That pretty much blows making a web IDE out of Cocoon! ....

Nasty business .....

Can anyone make any lateral suggestions for working around this problem?

thanks Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: HTML Formatter problem

Posted by "Pier P. Fumagalli" <pi...@apache.org>.
Jeremy Quinn wrote:
> 
> Hi Folks,
> 
> I asked this question on the Users list, with no reply, forgive me for the
> X-Post.
> 
> I am trying to output valid XML, inside HTML. (The valid XML is going
> inside a <textarea/>, so it can be edited and posted back to the server, as
> valid XML).
> 
> The XML sometimes includes Tags like <li>List Item</li>, The HTML
> Formatter, doing it's job properly, strips the ending </li> tag, producing
> valid HTML, but breaking it as XML.
> 
> Is it possible somehow to tell the HTML Formatter to not format the
> children of certain Element?
> 
> Thanks for any help
> 
> regards Jeremy

If the HTML formatter is still the one I wrote... Hmmm no, it's not
possible...

	Pier