Opened 10 years ago

Closed 10 years ago

#3472 closed Bug (invalid)

Reformatting breaks diff, <![CDATA[, inline XML

Reported by: Mark Whitis Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I typed some sample text into your demo to see if it would do something vaguely resembling the right thing with inline XML. Not only did it not do the right thing, it revealed an enormous bug.

Typed in source mode:

<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>
<myxml xmlns="http://www.example.com/foo/bar/baz">   
  <myxml2>foo</myxml2>   
  <myxml3>foo</myxml3> 
</myxml>

After switching to WYSIWYG mode and back to source mode, this had been badly mangled: <p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p> <p><myxml> <myxml2>foo</myxml2> <myxml3>foo</myxml3> </myxml></p>

Mangling:

  • Insertion of p tag
  • deletion of xmlns attribute
  • reformatting

Reformatting is absolutely unacceptable. Here is why: diff/patch, cvs, subversion, git, mercurial, arch, ...

It also breaks conflict resolution on a wiki.

NEVER reformat without explicit instructions to do so. The only text you can reformat is what someone edits and then keep as close to the original format as possible.

For tags you don't recognize, display the source for the duration of the tag and body.

Consider, also, what your mangling would do to something like this:

    <microcontroller_table_entry xmlns="...">
        <product>
           <manufacturer>NXP</manufacturer>
           <part_no>XX123</part_no>
        </product>
        <core>
           <cpu>ARM7TDMI</cpu>
           <bits>32</bits>
        </core>
        <memory>
          <flash>256KB</flash>
          <ram>64KB</ram>
        </memory>
        <buses>
          <usb>Yes</usb>
        </buses>
    </microcontroller_table_entry>

In its original form it is human readable/editable. In this format, it is not: <p><microcontroller_table_entry> <product> <manufacturer>NXP</manufacturer> <part_no>XX123</part_no> </product> <core> <cpu>ARM7TDMI</cpu> <bits>32</bits> </core> <memory> <flash>256KB</flash> <ram>64KB</ram> </memory> <buses> <usb>Yes</usb> </buses> </microcontroller_table_entry></p>

Of, course, there is the security/conformance issue of unrecognized tags. In the real world, these would need to be stripped where not explicitly allowed. They shouldn't be stripped without notifying user first as this could result in considerable loss of work.

As another test, I used a plain XHTML file:

http://www.freelabs.com/~whitis/linux/usb_ubuntu_9.04RC/index.xhtml

The file was badly mangled to the point where it was completely unrecognizable to diff. In addition to the mangling, there was another bug. In one place:

]]></code></pre>

which was the end of a <![CDATA[ section was displayed as "]]>" in WYSIWIG mode and the following text formated improperly.

Test this program with real web pages and diff.

Change History (1)

comment:1 Changed 10 years ago by Alfonso Martínez de Lizarrondo

Priority: HighNormal
Resolution: invalid
Status: newclosed

As soon as you are using a browser based WYSIWYG HTML editor you can't expect to retain the format of any generic XML structure.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy