XForm FCKEditor Escape Code Issue

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

XForm FCKEditor Escape Code Issue

Xin-4
Hi All,

I was looking the example: html area.

I found that in the instance, it needs some escaping:
<xforms:instance id="instance">
                <instance xmlns="">
                    <html>In the Orbeon Forms HTML area, you can use
different:&lt;br />&lt;ul>&lt;li>fonts like times or
courrier&lt;/li>&lt;li>&lt;font
size="3">sizes&lt;/font>&lt;/li>&lt;li>&lt;span style="background-color:
rgb(255, 153, 0);">background colors&lt;/span> or &lt;span style="color:
rgb(255, 102, 0);">text colors&lt;/span>&lt;span style="background-color:
rgb(255, 153, 0);">&lt;br />&lt;/span>&lt;/li>&lt;li>font styles like
&lt;span style="font-weight: bold;">bold &lt;/span>or &lt;span
style="font-style: italic;">italic&lt;/span>&lt;/li>&lt;/ul></html>
                </instance>
            </xforms:instance>

If we don't escape '<' to '&lt;'  then FCKEditor can't get the full content.
My question is that why do we need to do that escaping?
It makes harder when the FCKEditor ref a dynamic content.

Please help!

Thanks!
xin


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Erik Bruchez
Administrator
Xin,

There are a couple of good reasons:

* At the moment, XForms controls can only access elements' or
   attributes' text content. They do not have access to so-called mixed
   content. This means that the every control value has to be stored as
   text within the instance, which means that < must be escaped as you
   can't have a literal < in text in XML.

* Anyway the mediatype supported is text/html, not
   application/xhtml+xml, so escaping is unavoidable as you can't mix
   and match HTML and XHTML.

What you can do if you have a pseudo-XHTML fragment in an instance is
to use the saxon:serialize() function to transform that to serialized
HTML.

-Erik

Xin Chen wrote:
 > Hi All,
 >
 > I was looking the example:* html area.
 >
 > *I found that in the instance, it needs some escaping:
 > <xforms:instance id="instance">
 >                 <instance xmlns="">
 >                     <html>In the Orbeon Forms HTML area, you can use
 > different:&lt;br />&lt;ul>&lt;li>fonts like times or
 > courrier&lt;/li>&lt;li>&lt;font
 > size="3">sizes&lt;/font>&lt;/li>&lt;li>&lt;span style="background-color:
 > rgb(255, 153, 0);">background colors&lt;/span> or &lt;span style="color:
 > rgb(255, 102, 0);">text colors&lt;/span>&lt;span style="background-color:
 > rgb(255, 153, 0);">&lt;br />&lt;/span>&lt;/li>&lt;li>font styles like
 > &lt;span style="font-weight: bold;">bold &lt;/span>or &lt;span
 > style="font-style: italic;">italic&lt;/span>&lt;/li>&lt;/ul></html>
 >                 </instance>
 >             </xforms:instance>
 >
 > If we don't escape '*<*' to '*&lt;*'  then FCKEditor can't get the full
 > content.
 > My question is that why do we need to do that escaping?
 > It makes harder when the FCKEditor ref a dynamic content.
 >
 > Please help!
 >
 > Thanks!
 > xin
 >


--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Xin-4
Hi Erik,

Thanks a lot for this important information.

In this case, I do have another question, after we change the html content, how can we
pass back to XML? What I mean is we can use saxon:serialize() to escape XML to HTML, and pass to FCKeditor,
after that ,  when we submit the FCKeditor, what we should do to transfore HTML back to XML?

This is interesting :-)

Thanks !
xin

Erik Bruchez wrote:
Xin,

There are a couple of good reasons:

* At the moment, XForms controls can only access elements' or
  attributes' text content. They do not have access to so-called mixed
  content. This means that the every control value has to be stored as
  text within the instance, which means that < must be escaped as you
  can't have a literal < in text in XML.

* Anyway the mediatype supported is text/html, not
  application/xhtml+xml, so escaping is unavoidable as you can't mix
  and match HTML and XHTML.

What you can do if you have a pseudo-XHTML fragment in an instance is
to use the saxon:serialize() function to transform that to serialized
HTML.

-Erik

Xin Chen wrote:
> Hi All,
>
> I was looking the example:* html area.
>
> *I found that in the instance, it needs some escaping:
> <xforms:instance id="instance">
>                 <instance xmlns="">
>                     <html>In the Orbeon Forms HTML area, you can use
> different:&lt;br />&lt;ul>&lt;li>fonts like times or
> courrier&lt;/li>&lt;li>&lt;font
> size="3">sizes&lt;/font>&lt;/li>&lt;li>&lt;span style="background-color:
> rgb(255, 153, 0);">background colors&lt;/span> or &lt;span style="color:
> rgb(255, 102, 0);">text colors&lt;/span>&lt;span style="background-color:
> rgb(255, 153, 0);">&lt;br />&lt;/span>&lt;/li>&lt;li>font styles like
> &lt;span style="font-weight: bold;">bold &lt;/span>or &lt;span
> style="font-style: italic;">italic&lt;/span>&lt;/li>&lt;/ul></html>
>                 </instance>
>             </xforms:instance>
>
> If we don't escape '*<*' to '*&lt;*'  then FCKEditor can't get the full
> content.
> My question is that why do we need to do that escaping?
> It makes harder when the FCKEditor ref a dynamic content.
>
> Please help!
>
> Thanks!
> xin
>



-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Marcus-2
Hi,

to tranform HTML back to XML you can use saxon:parse().
The more important thing is, what do you wanna do with those snippets.
If you save them to the eXist-DB, be careful about the automatical index!

If you save something like:
 <div>Testentry</div>
-> that would be ok! Best would be to define those parts in the index as
"mixed content"

If you save:
&lt;div&gt;Testentry&lt;/div&gt;
-> The automatic index won't mention, that this is html-code, but store i.e.
"&lt;" as an own word to the index.

Hope that helps. Sorry but i have no time to read through the whole thread.
That were only some problems i had to face in my own application, using the
FCK too.
Regards, Marcus




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Erik Bruchez
Administrator
Marcus,

I am not sure saxon:parse() will work with any HTML produced by
FCKEditor, but you can try that.

Ideally, we would hook-up an HTML-to-XML extension function.

-Erik

Marcus wrote:

> Hi,
>
> to tranform HTML back to XML you can use saxon:parse().
> The more important thing is, what do you wanna do with those snippets.
> If you save them to the eXist-DB, be careful about the automatical index!
>
> If you save something like:
> <div>Testentry</div>
> -> that would be ok! Best would be to define those parts in the index as
> "mixed content"
>
> If you save:
> &lt;div&gt;Testentry&lt;/div&gt;
> -> The automatic index won't mention, that this is html-code, but store
> i.e. "&lt;" as an own word to the index.
>
> Hope that helps. Sorry but i have no time to read through the whole
> thread. That were only some problems i had to face in my own
> application, using the FCK too.
> Regards, Marcus
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Marcus-2
Hi Erik,
because FCKEditor produces XHTML 1.0 Code, saxon:parse() works!
I know that for sure, because i just worked with that in my app!
But of course you can use extension functions too :-)
Regards, Marcus



----- Original Message -----
From: "Erik Bruchez" <[hidden email]>
To: <[hidden email]>
Sent: Monday, September 24, 2007 10:11 PM
Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue


> Marcus,
>
> I am not sure saxon:parse() will work with any HTML produced by
> FCKEditor, but you can try that.
>
> Ideally, we would hook-up an HTML-to-XML extension function.
>
> -Erik
>
> Marcus wrote:
>> Hi,
>>
>> to tranform HTML back to XML you can use saxon:parse().
>> The more important thing is, what do you wanna do with those snippets.
>> If you save them to the eXist-DB, be careful about the automatical index!
>>
>> If you save something like:
>> <div>Testentry</div>
>> -> that would be ok! Best would be to define those parts in the index as
>> "mixed content"
>>
>> If you save:
>> &lt;div&gt;Testentry&lt;/div&gt;
>> -> The automatic index won't mention, that this is html-code, but store
>> i.e. "&lt;" as an own word to the index.
>>
>> Hope that helps. Sorry but i have no time to read through the whole
>> thread. That were only some problems i had to face in my own
>> application, using the FCK too.
>> Regards, Marcus
>>
>
>
> --
> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> http://www.orbeon.com/
>
>

--------------------------------------------------------------------------------


>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Erik Bruchez
Administrator
Marcus,

That's cool :-)

-Erik

Marcus wrote:

> Hi Erik,
> because FCKEditor produces XHTML 1.0 Code, saxon:parse() works!
> I know that for sure, because i just worked with that in my app!
> But of course you can use extension functions too :-)
> Regards, Marcus
>
>
>
> ----- Original Message ----- From: "Erik Bruchez" <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, September 24, 2007 10:11 PM
> Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue
>
>
>> Marcus,
>>
>> I am not sure saxon:parse() will work with any HTML produced by
>> FCKEditor, but you can try that.
>>
>> Ideally, we would hook-up an HTML-to-XML extension function.
>>
>> -Erik
>>
>> Marcus wrote:
>>> Hi,
>>>
>>> to tranform HTML back to XML you can use saxon:parse().
>>> The more important thing is, what do you wanna do with those snippets.
>>> If you save them to the eXist-DB, be careful about the automatical
>>> index!
>>>
>>> If you save something like:
>>> <div>Testentry</div>
>>> -> that would be ok! Best would be to define those parts in the index as
>>> "mixed content"
>>>
>>> If you save:
>>> &lt;div&gt;Testentry&lt;/div&gt;
>>> -> The automatic index won't mention, that this is html-code, but store
>>> i.e. "&lt;" as an own word to the index.
>>>
>>> Hope that helps. Sorry but i have no time to read through the whole
>>> thread. That were only some problems i had to face in my own
>>> application, using the FCK too.
>>> Regards, Marcus
>>>
>>
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
>>
>>
>
>
> --------------------------------------------------------------------------------
>
>
>
>>
>> --
>> You receive this message as a subscriber of the
>> [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>
>
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Xin-4
Hi All,

I wrote two stylesheets for these.
1, transfer XML to xhtml by using saxon:serialize()
2, transfer xhtml to XML by using saxon:parse()

It works!
However, it would be cool if we have some xxform extension function to
do that:)


Thanks,
xin

Erik Bruchez wrote:

> Marcus,
>
> That's cool :-)
>
> -Erik
>
> Marcus wrote:
>
>> Hi Erik,
>> because FCKEditor produces XHTML 1.0 Code, saxon:parse() works!
>> I know that for sure, because i just worked with that in my app!
>> But of course you can use extension functions too :-)
>> Regards, Marcus
>>
>>
>>
>> ----- Original Message ----- From: "Erik Bruchez" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Monday, September 24, 2007 10:11 PM
>> Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue
>>
>>
>>> Marcus,
>>>
>>> I am not sure saxon:parse() will work with any HTML produced by
>>> FCKEditor, but you can try that.
>>>
>>> Ideally, we would hook-up an HTML-to-XML extension function.
>>>
>>> -Erik
>>>
>>> Marcus wrote:
>>>
>>>> Hi,
>>>>
>>>> to tranform HTML back to XML you can use saxon:parse().
>>>> The more important thing is, what do you wanna do with those snippets.
>>>> If you save them to the eXist-DB, be careful about the automatical
>>>> index!
>>>>
>>>> If you save something like:
>>>> <div>Testentry</div>
>>>> -> that would be ok! Best would be to define those parts in the
>>>> index as
>>>> "mixed content"
>>>>
>>>> If you save:
>>>> &lt;div&gt;Testentry&lt;/div&gt;
>>>> -> The automatic index won't mention, that this is html-code, but
>>>> store
>>>> i.e. "&lt;" as an own word to the index.
>>>>
>>>> Hope that helps. Sorry but i have no time to read through the whole
>>>> thread. That were only some problems i had to face in my own
>>>> application, using the FCK too.
>>>> Regards, Marcus
>>>>
>>>
>>>
>>> --
>>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>> http://www.orbeon.com/
>>>
>>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>>
>>
>>>
>>> --
>>> You receive this message as a subscriber of the
>>> [hidden email] mailing list.
>>> To unsubscribe: mailto:[hidden email]
>>> For general help: mailto:[hidden email]?subject=help
>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>
>>
>>
>
>
>------------------------------------------------------------------------
>
>
>--
>You receive this message as a subscriber of the [hidden email] mailing list.
>To unsubscribe: mailto:[hidden email]
>For general help: mailto:[hidden email]?subject=help
>ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Marcus-2
HI,
what would be the difference between an xxforms extension and the
saxon-functions?
To be honest, some the xxforms extensions are i.e. saxon-extension
functions - sometimes its just the name!
Or did i miss something?

Regards, Marcus


----- Original Message -----
From: "Xin Chen" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, September 25, 2007 9:18 AM
Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue


> Hi All,
>
> I wrote two stylesheets for these.
> 1, transfer XML to xhtml by using saxon:serialize()
> 2, transfer xhtml to XML by using saxon:parse()
>
> It works!
> However, it would be cool if we have some xxform extension function to
> do that:)
>
>
> Thanks,
> xin
>
> Erik Bruchez wrote:
>
>> Marcus,
>>
>> That's cool :-)
>>
>> -Erik
>>
>> Marcus wrote:
>>
>>> Hi Erik,
>>> because FCKEditor produces XHTML 1.0 Code, saxon:parse() works!
>>> I know that for sure, because i just worked with that in my app!
>>> But of course you can use extension functions too :-)
>>> Regards, Marcus
>>>
>>>
>>>
>>> ----- Original Message ----- From: "Erik Bruchez" <[hidden email]>
>>> To: <[hidden email]>
>>> Sent: Monday, September 24, 2007 10:11 PM
>>> Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue
>>>
>>>
>>>> Marcus,
>>>>
>>>> I am not sure saxon:parse() will work with any HTML produced by
>>>> FCKEditor, but you can try that.
>>>>
>>>> Ideally, we would hook-up an HTML-to-XML extension function.
>>>>
>>>> -Erik
>>>>
>>>> Marcus wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> to tranform HTML back to XML you can use saxon:parse().
>>>>> The more important thing is, what do you wanna do with those snippets.
>>>>> If you save them to the eXist-DB, be careful about the automatical
>>>>> index!
>>>>>
>>>>> If you save something like:
>>>>> <div>Testentry</div>
>>>>> -> that would be ok! Best would be to define those parts in the
>>>>> index as
>>>>> "mixed content"
>>>>>
>>>>> If you save:
>>>>> &lt;div&gt;Testentry&lt;/div&gt;
>>>>> -> The automatic index won't mention, that this is html-code, but
>>>>> store
>>>>> i.e. "&lt;" as an own word to the index.
>>>>>
>>>>> Hope that helps. Sorry but i have no time to read through the whole
>>>>> thread. That were only some problems i had to face in my own
>>>>> application, using the FCK too.
>>>>> Regards, Marcus
>>>>>
>>>>
>>>>
>>>> --
>>>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>>> http://www.orbeon.com/
>>>>
>>>>
>>>
>>>
>>> --------------------------------------------------------------------------------
>>>
>>>
>>>
>>>>
>>>> --
>>>> You receive this message as a subscriber of the
>>>> [hidden email] mailing list.
>>>> To unsubscribe: mailto:[hidden email]
>>>> For general help: mailto:[hidden email]?subject=help
>>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>>
>>>
>>>
>>
>>
>>------------------------------------------------------------------------
>>
>>
>>--
>>You receive this message as a subscriber of the [hidden email]
>>mailing list.
>>To unsubscribe: mailto:[hidden email]
>>For general help: mailto:[hidden email]?subject=help
>>ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>
>>
>
>
>

--------------------------------------------------------------------------------


>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Erik Bruchez
Administrator
In reply to this post by Xin-4
Xin,

You can use saxon:serialize() and saxon:parse() directly from XForms.

-Erik

Xin Chen wrote:

> Hi All,
>
> I wrote two stylesheets for these.
> 1, transfer XML to xhtml by using saxon:serialize()
> 2, transfer xhtml to XML by using saxon:parse()
>
> It works!
> However, it would be cool if we have some xxform extension function to
> do that:)
>
>
> Thanks,
> xin
>
> Erik Bruchez wrote:
>
>> Marcus,
>>
>> That's cool :-)
>>
>> -Erik
>>
>> Marcus wrote:
>>
>>> Hi Erik,
>>> because FCKEditor produces XHTML 1.0 Code, saxon:parse() works!
>>> I know that for sure, because i just worked with that in my app!
>>> But of course you can use extension functions too :-)
>>> Regards, Marcus
>>>
>>>
>>>
>>> ----- Original Message ----- From: "Erik Bruchez" <[hidden email]>
>>> To: <[hidden email]>
>>> Sent: Monday, September 24, 2007 10:11 PM
>>> Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue
>>>
>>>
>>>> Marcus,
>>>>
>>>> I am not sure saxon:parse() will work with any HTML produced by
>>>> FCKEditor, but you can try that.
>>>>
>>>> Ideally, we would hook-up an HTML-to-XML extension function.
>>>>
>>>> -Erik
>>>>
>>>> Marcus wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> to tranform HTML back to XML you can use saxon:parse().
>>>>> The more important thing is, what do you wanna do with those snippets.
>>>>> If you save them to the eXist-DB, be careful about the automatical
>>>>> index!
>>>>>
>>>>> If you save something like:
>>>>> <div>Testentry</div>
>>>>> -> that would be ok! Best would be to define those parts in the
>>>>> index as
>>>>> "mixed content"
>>>>>
>>>>> If you save:
>>>>> &lt;div&gt;Testentry&lt;/div&gt;
>>>>> -> The automatic index won't mention, that this is html-code, but
>>>>> store
>>>>> i.e. "&lt;" as an own word to the index.
>>>>>
>>>>> Hope that helps. Sorry but i have no time to read through the whole
>>>>> thread. That were only some problems i had to face in my own
>>>>> application, using the FCK too.
>>>>> Regards, Marcus
>>>>>
>>>>
>>>>
>>>> --
>>>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>>> http://www.orbeon.com/
>>>>
>>>>
>>>
>>>
>>> --------------------------------------------------------------------------------
>>>
>>>
>>>
>>>>
>>>> --
>>>> You receive this message as a subscriber of the
>>>> [hidden email] mailing list.
>>>> To unsubscribe: mailto:[hidden email]
>>>> For general help: mailto:[hidden email]?subject=help
>>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>>
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> You receive this message as a subscriber of the
>> [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>>
>
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Javabeans delegation

Nikola Radic
Hello,

I'm trying to utilize delegation processor and javabeans but whatever return
type I use, the final output (when debug is called from xpl)  is not
correct.

In the documentation I found the following:

>>> For calls to JavaBeans and EJBs in particular, it is important that the
resulting document be a well-formed XML document.

What type is XML document?

I tried to use as a return type org.w3c.Document and org.dom4j.Document (
and well formed XML like String) but the result is not correct (I either get
class signature when using Document classes or string value where all < >
are replaced with corresponding entities).

Any help is appreciated.

Nikola





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Javabeans delegation

Alessandro Vernet
Administrator
Nikola,

On 9/25/07, Nikola Radic <[hidden email]> wrote:
> >>> For calls to JavaBeans and EJBs in particular, it is important that the
> resulting document be a well-formed XML document.
>
> What type is XML document?

The result from your JavaBean or EJB must be a String. This is the
only supported type. What the text you quote from the documentation
means is that you need to create a valid XML document in your "call",
so for instance consider:

<p:input name="call">
    <delegation:execute service="my-service" operation="myMethod">
        <param1 xsi:type="xs:string">param1</param1>
    </delegation:execute>
</p:input>

If you are calling an EJB or JavaBean, this call will just return a
string, which is not a valid document. Instead you would need to
write:

<p:input name="call">
    <result>
        <delegation:execute service="my-service" operation="myMethod">
            <param1 xsi:type="xs:string">param1</param1>
        </delegation:execute>
    </result>
</p:input>

We are considering to deprecate the Delegation processor. So I would
recommend you write you own processor, call your JavaBean in that
processor, and use the Java processor to call that processor. With the
Java processor, you can have your Java code in the resources and it
will be compiled for you as necessary at runtime, which is quite
convenient. See:

http://www.orbeon.com/ops/doc/processors-java

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Xin-4
In reply to this post by Erik Bruchez
Hi Erik,

You mean put XSLT in XForms?
Yes, I tried that before. The problem is:
say I have one instance:
<fckcontent>
    <p>this is the content that will pass into FCKeditor</p>
<fckcontent>

I create another temp instance by using xform:bind.
<tempinstance>
    <myhtml></myhtml>
</tempinstance>

bind is somehting like:
<xform:bind nodeset="tempinstance/myhtml"
calculate="xxform:serialize(fckcontent,'html')"./>

and in FCKhtml area, I just ref to tempinstance.

All these steps works fine. The problem is how can I write the xml back
to the original instance.
I was trying to use another bind:
<xform:bind nodeset="fckcontent"
calculate="xxform:parse(tempinstance/myhtml)"/>

It doesn't work. As two instances bind each other, somehow it doesn't work.

I think there should be another way to write it back, cause I am not so
familiar with xform, then I choose the other way which by using external
xslt to do that.

I need to spend more time on XFORM studying.

Comments welcome:)

xin



Erik Bruchez wrote:

> Xin,
>
> You can use saxon:serialize() and saxon:parse() directly from XForms.
>
> -Erik
>
> Xin Chen wrote:
>
>> Hi All,
>>
>> I wrote two stylesheets for these.
>> 1, transfer XML to xhtml by using saxon:serialize()
>> 2, transfer xhtml to XML by using saxon:parse()
>>
>> It works!
>> However, it would be cool if we have some xxform extension function
>> to do that:)
>>
>>
>> Thanks,
>> xin
>>
>> Erik Bruchez wrote:
>>
>>> Marcus,
>>>
>>> That's cool :-)
>>>
>>> -Erik
>>>
>>> Marcus wrote:
>>>
>>>> Hi Erik,
>>>> because FCKEditor produces XHTML 1.0 Code, saxon:parse() works!
>>>> I know that for sure, because i just worked with that in my app!
>>>> But of course you can use extension functions too :-)
>>>> Regards, Marcus
>>>>
>>>>
>>>>
>>>> ----- Original Message ----- From: "Erik Bruchez"
>>>> <[hidden email]>
>>>> To: <[hidden email]>
>>>> Sent: Monday, September 24, 2007 10:11 PM
>>>> Subject: Re: [ops-users] XForm FCKEditor Escape Code Issue
>>>>
>>>>
>>>>> Marcus,
>>>>>
>>>>> I am not sure saxon:parse() will work with any HTML produced by
>>>>> FCKEditor, but you can try that.
>>>>>
>>>>> Ideally, we would hook-up an HTML-to-XML extension function.
>>>>>
>>>>> -Erik
>>>>>
>>>>> Marcus wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> to tranform HTML back to XML you can use saxon:parse().
>>>>>> The more important thing is, what do you wanna do with those
>>>>>> snippets.
>>>>>> If you save them to the eXist-DB, be careful about the
>>>>>> automatical index!
>>>>>>
>>>>>> If you save something like:
>>>>>> <div>Testentry</div>
>>>>>> -> that would be ok! Best would be to define those parts in the
>>>>>> index as
>>>>>> "mixed content"
>>>>>>
>>>>>> If you save:
>>>>>> &lt;div&gt;Testentry&lt;/div&gt;
>>>>>> -> The automatic index won't mention, that this is html-code, but
>>>>>> store
>>>>>> i.e. "&lt;" as an own word to the index.
>>>>>>
>>>>>> Hope that helps. Sorry but i have no time to read through the whole
>>>>>> thread. That were only some problems i had to face in my own
>>>>>> application, using the FCK too.
>>>>>> Regards, Marcus
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>>>> http://www.orbeon.com/
>>>>>
>>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>>>
>>>>> --
>>>>> You receive this message as a subscriber of the
>>>>> [hidden email] mailing list.
>>>>> To unsubscribe: mailto:[hidden email]
>>>>> For general help: mailto:[hidden email]?subject=help
>>>>> ObjectWeb mailing lists service home page:
>>>>> http://www.objectweb.org/wws
>>>>>
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>>
>>> --
>>> You receive this message as a subscriber of the
>>> [hidden email] mailing list.
>>> To unsubscribe: mailto:[hidden email]
>>> For general help: mailto:[hidden email]?subject=help
>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>  
>>>
>>
>>
>
>
>------------------------------------------------------------------------
>
>
>--
>You receive this message as a subscriber of the [hidden email] mailing list.
>To unsubscribe: mailto:[hidden email]
>For general help: mailto:[hidden email]?subject=help
>ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForm FCKEditor Escape Code Issue

Alessandro Vernet
Administrator
Hi Xin,

On 9/25/07, Xin Chen <[hidden email]> wrote:
> You mean put XSLT in XForms?

You should be able to do that in XForms.

> [...]
> It doesn't work. As two instances bind each other, somehow it doesn't work.
>
> I think there should be another way to write it back, cause I am not so
> familiar with xform, then I choose the other way which by using external
> xslt to do that.

Using a calculate both ways won't work, like you say. I think you will need to:

* Initialize myhtml based on fckcontent doing a seralize() when the
instance loads, say in xforms-ready (maybe you need to put this in
other places if the instance fckcontent is replaced).
* Initialize fckcontent based on myhtml doing a parse() before you
send fckcontent back to the server. If you have a trigger that runs a
"send" action, you can use an xforms:insert before the xforms:send to
initialize fckcontent.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Javabeans delegation

Nikola Radic
In reply to this post by Alessandro Vernet
Hi Alex,

Thanks for your answer. I'll go with custom processor.

There is another issue that I've noticed in the forms and don't know if it
is bug or not.

Namely, e.g. I have 5 fields on the form and some of them are mandatory.
When focus is on mandatory field, AJAX request is posted to the server and
this is normal.

However, the same thing happens for non-mandatory fields.

Is there a way to avoid this in order to prevent accident request postings?

Regards,

Nikola



----- Original Message -----
From: "Alessandro Vernet" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, September 25, 2007 9:03 PM
Subject: Re: [ops-users] Javabeans delegation


> Nikola,
>
> On 9/25/07, Nikola Radic <[hidden email]> wrote:
> > >>> For calls to JavaBeans and EJBs in particular, it is important that
the

> > resulting document be a well-formed XML document.
> >
> > What type is XML document?
>
> The result from your JavaBean or EJB must be a String. This is the
> only supported type. What the text you quote from the documentation
> means is that you need to create a valid XML document in your "call",
> so for instance consider:
>
> <p:input name="call">
>     <delegation:execute service="my-service" operation="myMethod">
>         <param1 xsi:type="xs:string">param1</param1>
>     </delegation:execute>
> </p:input>
>
> If you are calling an EJB or JavaBean, this call will just return a
> string, which is not a valid document. Instead you would need to
> write:
>
> <p:input name="call">
>     <result>
>         <delegation:execute service="my-service" operation="myMethod">
>             <param1 xsi:type="xs:string">param1</param1>
>         </delegation:execute>
>     </result>
> </p:input>
>
> We are considering to deprecate the Delegation processor. So I would
> recommend you write you own processor, call your JavaBean in that
> processor, and use the Java processor to call that processor. With the
> Java processor, you can have your Java code in the resources and it
> will be compiled for you as necessary at runtime, which is quite
> convenient. See:
>
> http://www.orbeon.com/ops/doc/processors-java
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> http://www.orbeon.com/
>
>

----------------------------------------------------------------------------
----


>
> --
> You receive this message as a subscriber of the [hidden email]
mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Javabeans delegation

Alessandro Vernet
Administrator
Nikola,

On 9/26/07, Nikola Radic <[hidden email]> wrote:
> There is another issue that I've noticed in the forms and don't know if it
> is bug or not.
>
> Namely, e.g. I have 5 fields on the form and some of them are mandatory.
> When focus is on mandatory field, AJAX request is posted to the server and
> this is normal.
>
> However, the same thing happens for non-mandatory fields.

If you are  saying that you see Ajax requests between the browser and
the server when tabbing between fields, then this is normal. At this
time, you will see a number of Ajax request made between the client
and the server, even when you can gather by looking at the XForms code
that there is nothing that the server needs to do in this case. But of
course, this should not cause any problem. It will just keep electrons
on that Ethernet cable and the CPU on the server a little more busy
:).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Javabeans delegation

Nikola Radic
Alex,

> course, this should not cause any problem. It will just keep electrons
> on that Ethernet cable and the CPU on the server a little more busy

In the environment with min. 100 concurent users, Ethernet and CPU will be
more than busy.
Any way to prevent this behaviour?

Nikola

----- Original Message -----
From: "Alessandro Vernet" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, September 26, 2007 10:36 PM
Subject: Re: [ops-users] Javabeans delegation


> Nikola,
>
> On 9/26/07, Nikola Radic <[hidden email]> wrote:
> > There is another issue that I've noticed in the forms and don't know if
it
> > is bug or not.
> >
> > Namely, e.g. I have 5 fields on the form and some of them are mandatory.
> > When focus is on mandatory field, AJAX request is posted to the server
and

> > this is normal.
> >
> > However, the same thing happens for non-mandatory fields.
>
> If you are  saying that you see Ajax requests between the browser and
> the server when tabbing between fields, then this is normal. At this
> time, you will see a number of Ajax request made between the client
> and the server, even when you can gather by looking at the XForms code
> that there is nothing that the server needs to do in this case. But of
> course, this should not cause any problem. It will just keep electrons
> on that Ethernet cable and the CPU on the server a little more busy
> :).
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> http://www.orbeon.com/
>
>

----------------------------------------------------------------------------
----


>
> --
> You receive this message as a subscriber of the [hidden email]
mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Javabeans delegation

Alessandro Vernet
Administrator
Nikola,

On 9/27/07, Nikola Radic <[hidden email]> wrote:
> In the environment with min. 100 concurent users, Ethernet and CPU will be
> more than busy.
> Any way to prevent this behaviour?

Yes, of course, I understand. At this point you can't get around this.
But this is definitely an optimization that we'd like to implement.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: [ops-users] Javabeans delegation

Erik Bruchez
Administrator
Alessandro Vernet wrote:
> Nikola,
>
> On 9/27/07, Nikola Radic <[hidden email]> wrote:
>> In the environment with min. 100 concurent users, Ethernet and CPU will be
>> more than busy.
>> Any way to prevent this behaviour?
>
> Yes, of course, I understand. At this point you can't get around this.
> But this is definitely an optimization that we'd like to implement.

The deep reason why many Ajax events are sent to the server is that all
the XForms event handling is implemented on the server. Such events
include value changes, clicks, and focus changes. Currently, we do not
optimize this and will tell the server about things occurring on the
client even if, for example, there are no related event handlers anyway.
This is clearly where some optimizations could be done to reduce traffic.

Note that we already optimize Ajax events by grouping events into single
Ajax messages. For example if you tab fast between fields then you will
see a single Ajax message sent after a while instead of just one per tab.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: [ops-users] Javabeans delegation

Erik Bruchez
Administrator
In reply to this post by Alessandro Vernet
Alessandro Vernet wrote:
> Nikola,
>
> On 9/27/07, Nikola Radic <[hidden email]> wrote:
>> In the environment with min. 100 concurent users, Ethernet and CPU will be
>> more than busy.
>> Any way to prevent this behaviour?
>
> Yes, of course, I understand. At this point you can't get around this.
> But this is definitely an optimization that we'd like to implement.

The deep reason why many Ajax events are sent to the server is that all
the XForms event handling is implemented on the server. Such events
include value changes, clicks, and focus changes. Currently, we do not
optimize this and will tell the server about things occurring on the
client even if, for example, there are no related event handlers anyway.
This is clearly where some optimizations could be done to reduce traffic.

Note that we already optimize Ajax events by grouping events into single
Ajax messages. For example if you tab fast between fields then you will
see a single Ajax message sent after a while instead of just one per tab.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
12