Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-32359

Validation errors when converting ezxmltext - element section has extra content

    XMLWordPrintable

    Details

      Description

      Converting an XMLText field to RichText can produce a validation error, and migrated RichText field will throw "Content did not validate" exceptions later, making it uneditable.

      Steps to reproduce
      1. Clean installation of eZ Platform 2.5/Ibexa DXP 3.x
      2. Install https://github.com/ezsystems/ezplatform-xmltext-fieldtype
      3. Create a new Content Type - XML Test with fields: 

      • name (single line)
      • text (XMLBlock)
        4. Create a new Content of type XML Test with text field of value:
        <?xml version="1.0" encoding="UTF-8"?>
        <section xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/" xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/">
           <section>
              <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">
                 <table border="0" width="400px">
                    <tr>
                       <td xhtml:width="100"/>
                       <td xhtml:width="150">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                       <td xhtml:width="150">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                    </tr>
                    <tr>
                       <td xhtml:width="100">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                       <td xhtml:width="150">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                       <td xhtml:rowspan="3" xhtml:width="150" custom:valign="center">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                    </tr>
                    <tr>
                       <td xhtml:width="100">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                       <td xhtml:width="150">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                    </tr>
                    <tr>
                       <td xhtml:width="100">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                       <td xhtml:width="150">
                          <paragraph>Lorem ipsum</paragraph>
                       </td>
                    </tr>
                 </table>
              </paragraph>
           </section>
        </section>

        5. Publish it.
        6. Clear cache and run conversion command:

        php bin/console ezxmltext:convert-to-richtext 

      Result
      The conversion command will report:

      ERROR     [app] Validation errors when converting ezxmltext for contentobject_attribute.id=X 

      Expected result
      The conversion command completes without errors.

      Note
      The underlying error is:

      Error in 2:0: Element section has extra content: informaltable 

      XML output for RichText:

      <?xml version="1.0" encoding="UTF-8"?>
      <section xmlns="http://docbook.org/ns/docbook" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0-variant ezpublish-1.0">
         <informaltable width="400">
            <tbody>
               <tr>
                  <td ezxhtml:width="100" />
                  <td ezxhtml:width="150">
                     <para>Lorem ipsum</para>
                  </td>
                  <td ezxhtml:width="150">
                     <para>Lorem ipsum</para>
                  </td>
               </tr>
               <tr>
                  <td ezxhtml:width="100">
                     <para>Lorem ipsum</para>
                  </td>
                  <td ezxhtml:width="150">
                     <para>Lorem ipsum</para>
                  </td>
                  <td ezxhtml:width="150" valign="center" rowspan="3">
                     <ezattribute>
                        <ezvalue key="valign">center</ezvalue>
                     </ezattribute>
                     <para>Lorem ipsum</para>
                  </td>
               </tr>
               <tr>
                  <td ezxhtml:width="100">
                     <para>Lorem ipsum</para>
                  </td>
                  <td ezxhtml:width="150">
                     <para>Lorem ipsum</para>
                  </td>
               </tr>
               <tr>
                  <td ezxhtml:width="100">
                     <para>Lorem ipsum</para>
                  </td>
                  <td ezxhtml:width="150">
                     <para>Lorem ipsum</para>
                  </td>
               </tr>
            </tbody>
         </informaltable>
      </section>

      During tests, I was able to spot Errors for different tags as well, for example, title.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            mateusz.bieniek@ibexa.co Mateusz Bieniek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: