Replacing characters in an "ask" editor variable

Post here questions and problems related to oXygen frameworks/document types.
stdu
Posts: 80

Replacing characters in an "ask" editor variable

Wed Mar 26, 2014 4:48 pm

Hi!

Were using the editor variable in our framwork (for Author 14.2)

Code: Select all

${ask('Input URL', url, '')}


to offer our users the possibility to inserts links in documents. Sometimes the URLs contains the character "&". If this is the case, the functions prohibit the insertion (due to XML rules). It would be nice if the function could replacing "&" with "&" (and other possible problematic characters) to allow such actions. Is this possible?

Thx & Greets,
Stefan

PS: It seems, that with the type "generic" Oxygen checks also the insertion of non-valid characters.
Radu
Posts: 5376

Re: Replacing characters in an "ask" editor variable

Wed Mar 26, 2014 5:28 pm

Hi Stefan,

I think you are right, I added an improvement request to our issues list to XML-escape the URL's value when the $ask editor variable is used from a code template or as a parameter to an AuthorOperation. You are using it as a parameter passed to an Author Operation, right?

As a workaround of course you can implement your own Author Operation and show your own Java Swing-based dialog to the user, then use our API to insert the value.

About this remark:

It seems, that with the type "generic" Oxygen checks also the insertion of non-valid characters.


Do you mean that when you use something like:

Code: Select all

${ask('Input text', '')}


you would also want the inserted characters to be automatically XML-escaped?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stdu
Posts: 80

Re: Replacing characters in an "ask" editor variable

Thu Mar 27, 2014 2:06 pm

Hi Radu,

thx for adding the feature request! That would be great!
And you're right: we're using it as parameter passed to an Author Operation (SourroundWithFragment). At the moment I think, that all content in ask-Variables should be escaped, because it has to due to XML rules ... or is there any counter-argument?

Thx & kind regards,
Stefan
Radu
Posts: 5376

Re: Replacing characters in an "ask" editor variable

Thu Mar 27, 2014 3:12 pm

Hi Stefan,

We'll consider this, I assume that most of the times you use the $ask to request a value for a certain attribute, right?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stdu
Posts: 80

Re: Replacing characters in an "ask" editor variable

Tue Apr 15, 2014 3:03 pm

Hi Radu,

sorry for the late reply - I was in holiday for the last two weeks.
And, yes, that's right: we use it most of the times for attribute values.

I've seen your update changelog from yesterday:

Author/Form Controls: Entering XML reserved characters (&, <) in a form control that is editing the value of an attribute, would result in an invalid XML document.


Do you have already solve this issue with the last update?

Greets,
Stefan
alex_jitianu
Posts: 624

Re: Replacing characters in an "ask" editor variable

Tue Apr 15, 2014 4:02 pm

Hi Stefan,

That note actually refers to a different issue: while editing attributes with form controls, reserved characters (&, <) were not escaped. The fix to the issue from this thread is not present in the update.

Best regards,
Alex
Radu
Posts: 5376

Re: Replacing characters in an "ask" editor variable

Fri May 23, 2014 2:09 pm

Hi Stefan,

Oxygen 16.0 which was released a couple of days ago should have a fix for your improvement request to automatically escape content inserted by the user using the ask editor variable prompt dialog.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stdu
Posts: 80

Re: Replacing characters in an "ask" editor variable

Wed Feb 03, 2016 1:26 pm

Hi Radu,

in 17.1 the Author denied to insert unescaped ampersands (&), but doesn't replace them? Is this intended? Or do I have to activate some flag elsewhere?

Kind regards,
Stefan
Radu
Posts: 5376

Re: Replacing characters in an "ask" editor variable

Wed Feb 03, 2016 2:47 pm

Hi Stefan,

Just tested an Author InsertFragmentOperation with an XML like:

Code: Select all

<p audience="${ask('Message', url)}"/>


and you are right, the & should be automatically escaped.
We'll fix this, I will try to integrate a fix also in the next Oxygen 17.1 minor bug fix release.
I'll update this thread when a fix is available.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stdu
Posts: 80

Re: Replacing characters in an "ask" editor variable

Wed Feb 03, 2016 4:10 pm

Cool, thank you, Radu!
ionela
Posts: 167

Re: Replacing characters in an "ask" editor variable

Tue Feb 09, 2016 11:49 am

Hi,

Just to update the thread, this problem has been resolved in the latest maintenance build of oXygen 17.1, 2016020417(released on February 5th):
Author: URL values returned by the ${ask} editor variable used in AuthorOperation parameters were not automatically XML-escaped

You can download it from our web site:
http://www.oxygenxml.com/download.html

The list of bug-fixes can be found here:
http://www.oxygenxml.com/build_history.html#2016020417

You can follow the release/build RSS feed here:
http://www.oxygenxml.com/rssBuildID.xml

Let us know if you encounter further problems with this new build.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 0 guests