1

Topic: XML Processing Instructions preserve

I am trying to edit text in tinyMCE that also contains XML Processing Instructions as like as <?xml version="1.0"?>. But when I update the Processing Instructions are converted as comments as like as <!--xml version="1.0"-->

Please advise how to preserve the processing instruction.

2

Re: XML Processing Instructions preserve

What has this got to do with WYSIWYG? Are you sure you use this tool according to its original purpose?

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

3

Re: XML Processing Instructions preserve

Of course I use it for WYSIWYG. But, my HTML will have some Processing Instruction (<?pi insert version?>) which will then used for other applications where the HTML will go. So, I do not want to change any of the Processing Instruction in the HTML. I just want to preserve them as is.

4

Re: XML Processing Instructions preserve

sarankup wrote:

Of course I use it for WYSIWYG.

You didn't get at what I was hinting.

sarankup wrote:

But, my HTML will have some Processing Instruction (<?pi insert version?>)

Those instructions have nothing to do with the principle of WYSIWYG. You can't "see" what these instructions will do because they have no visual representation in your WYSIWYG area. This is why I say that they have nothing to do with WYSIWYG and therefore your usage breaks with the WYSIWYG principle. TinyMCE is a WYSIWYG tool and you want to use it for something it wasn't designed for.

Use real HTML elements as placeholders for your server-side instructions such as paragraphs with certain class names:

<p class="pi"> insert version</p>

Using clever CSS your editor can then display something that the user recognizes as (dynamic) content. Your editor will treat it as such and won't change it into anything you don't want. All you'd need is a suitable conversion in your backend.

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

5

Re: XML Processing Instructions preserve

If you really need PI:s in HTML for some odd reason just:
replace <!--? with <? and ?--> with ?> server side. Needs one line of code and your done.

Best regards,
Spocke - Main developer of TinyMCE

6

Re: XML Processing Instructions preserve

Well. Many thanks for your valuable reply. But in my HTML, I need to use Comment, and Processing Instruction feature with TinyMCE. And they must be preserved as is. But the current Version of TinyMCE converts all PI to Comment, so, I could not distinguish what was really Comments and what was PI.

I come to another note, about new <p> element with class, would not work in my case. Because, all my Processing Instruction will have Some application specific text. For example, I need to use < symbol as is. But, when it comes inside any element then TinyMCE will convert < to &lt; so, this will cause a problem to me.

7

Re: XML Processing Instructions preserve

sarankup wrote:

But in my HTML, I need to use Comment, and Processing Instruction feature [...] And they must be preserved as is. [...] new <p> element with class, would not work in my case. Because, all my Processing Instruction will have Some application specific text. For example, I need to use < symbol as is. But, when it comes inside any element then TinyMCE will convert < to &lt; so, this will cause a problem to me.

You have been given two ideas how to solve your problem. Good luck!

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)