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

EzXmlText to RichText validation error : Element section has extra content on <literal> tag

    Details

      Description

      I try to use command ezxmltext:convert-to-richtext of the bundle EzPlatformXmlTextFieldTypeBundle.

      I have the following error with a lot of inputs return by the validator :
      Error in 0:0: Element section has extra content: para

      An example of input :

      <?xml version="1.0" encoding="utf-8"?>\n
      <section
      xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
      xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
      xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
      <paragraph>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</paragraph>
      <paragraph>(Nous fournir la source du flash SVP)</paragraph>
      <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">
      <literal class="html">...</literal>
      </paragraph>
      </section>

      The xml output by the convert :

      <section
      xmlns="http://docbook.org/ns/docbook"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml"
      xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0">
      <para>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</para>
      <para>(Nous fournir la source du flash SVP)</para>
      ...
      </section>

      The following error can also appear :
      Error in 0:0: Element section has extra content: informaltable

      More examples that end up with informaltable and para errors can be found in the attached XML files.

      1. example1.xml
        4 kB
        Konrad Oboza
      2. example2.xml
        1 kB
        Konrad Oboza
      3. example3.xml
        20 kB
        Konrad Oboza

        Issue Links

          Activity

          Faïsse Valentin created issue -
          Vidar Langseid made changes -
          Field Original Value New Value
          Link This issue is blocked by EZP-29328 [ EZP-29328 ]
          Hide
          Vidar Langseid added a comment -

          Unfortunately, richtext in ezplatform do not yet support the <literal> tag.

          A workaround would be to strip away all <literal> tags. This can quite easily be done if running master of ezplatform-xmltext-fieldtype by altering lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl :

          diff --git a/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl b/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl
          index be70566..80f6c34 100644
          --- a/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl
          +++ b/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl
          @@ -15,6 +15,10 @@
             <xsl:key name="ids" match="*[@xhtml:id]" use="@xhtml:id"/>
             <xsl:key name="ids" match="//embed[@ezlegacytmp-embed-link-id]" use="@ezlegacytmp-embed-link-id"/>
           
          +  <!-- temporary workaround : Remove literals as they are not yet supported in our docbook format -->
          +  <xsl:template match="literal">
          +  </xsl:template>
          +
             <xsl:template match="custom">
               <xsl:element name="eztemplateinline" namespace="http://docbook.org/ns/docbook">
                 <xsl:attribute name="name">
          

          You might (not tested) use the latest released ezplatform-xmltext-fieldtype too, but then you have to apply the change to vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/ezxml/docbook/core.xsl instead

          Another solution would maybe be to convert the <literal> tags to some custom tag, but that is not something the conversion tool can do ATM

          Show
          Vidar Langseid added a comment - Unfortunately, richtext in ezplatform do not yet support the <literal> tag. A workaround would be to strip away all <literal> tags. This can quite easily be done if running master of ezplatform-xmltext-fieldtype by altering lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl : diff --git a/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl b/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl index be70566..80f6c34 100644 --- a/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl +++ b/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Docbook_core.xsl @@ -15,6 +15,10 @@ <xsl:key name="ids" match="*[@xhtml:id]" use="@xhtml:id"/> <xsl:key name="ids" match="//embed[@ezlegacytmp-embed-link-id]" use="@ezlegacytmp-embed-link-id"/> + <!-- temporary workaround : Remove literals as they are not yet supported in our docbook format --> + <xsl:template match="literal"> + </xsl:template> + <xsl:template match="custom"> <xsl:element name="eztemplateinline" namespace="http://docbook.org/ns/docbook"> <xsl:attribute name="name"> You might (not tested) use the latest released ezplatform-xmltext-fieldtype too, but then you have to apply the change to vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/ezxml/docbook/core.xsl instead Another solution would maybe be to convert the <literal> tags to some custom tag, but that is not something the conversion tool can do ATM
          Konrad Oboza made changes -
          Status Open [ 1 ] Confirmed [ 10037 ]
          Konrad Oboza made changes -
          Fix Version/s Customer request [ 11018 ]
          Konrad Oboza made changes -
          Affects Version/s 2.2.1 [ 14999 ]
          Konrad Oboza made changes -
          Description I try to use command ezxmltext:convert-to-richtext of the bundle EzPlatformXmlTextFieldTypeBundle.

          I have the following error with a lot of inputs return by the validator :
          Error in 0:0: Element section has extra content: para

          An example of input :
          {quote}
          <?xml version="1.0" encoding="utf-8"?>\n
          <section
          xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
          xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
          xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
          <paragraph>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</paragraph>
          <paragraph>(Nous fournir la source du flash SVP)</paragraph>
          <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">
          <literal class="html">...</literal>
          </paragraph>
          </section>
          {quote}

          The xml output by the convert :
          {quote}
          <section
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml"
          xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0">
          <para>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</para>
          <para>(Nous fournir la source du flash SVP)</para>
          ...
          </section>
          {quote}

          The following error can also appear :
          Error in 0:0: Element section has extra content: informaltable
          I try to use command ezxmltext:convert-to-richtext of the bundle EzPlatformXmlTextFieldTypeBundle.

          I have the following error with a lot of inputs return by the validator :
          Error in 0:0: Element section has extra content: para

          An example of input :
          {quote}
          <?xml version="1.0" encoding="utf-8"?>\n
          <section
          xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
          xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
          xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
          <paragraph>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</paragraph>
          <paragraph>(Nous fournir la source du flash SVP)</paragraph>
          <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">
          <literal class="html">...</literal>
          </paragraph>
          </section>
          {quote}

          The xml output by the convert :
          {quote}
          <section
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml"
          xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0">
          <para>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</para>
          <para>(Nous fournir la source du flash SVP)</para>
          ...
          </section>
          {quote}

          The following error can also appear :
          Error in 0:0: Element section has extra content: informaltable

          More examples with errors regarding informaltable and para in the attached XML files.
          Konrad Oboza made changes -
          Attachment example1.xml [ 31177 ]
          Attachment example2.xml [ 31178 ]
          Attachment example3.xml [ 31179 ]
          Konrad Oboza made changes -
          Description I try to use command ezxmltext:convert-to-richtext of the bundle EzPlatformXmlTextFieldTypeBundle.

          I have the following error with a lot of inputs return by the validator :
          Error in 0:0: Element section has extra content: para

          An example of input :
          {quote}
          <?xml version="1.0" encoding="utf-8"?>\n
          <section
          xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
          xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
          xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
          <paragraph>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</paragraph>
          <paragraph>(Nous fournir la source du flash SVP)</paragraph>
          <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">
          <literal class="html">...</literal>
          </paragraph>
          </section>
          {quote}

          The xml output by the convert :
          {quote}
          <section
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml"
          xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0">
          <para>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</para>
          <para>(Nous fournir la source du flash SVP)</para>
          ...
          </section>
          {quote}

          The following error can also appear :
          Error in 0:0: Element section has extra content: informaltable

          More examples with errors regarding informaltable and para in the attached XML files.
          I try to use command ezxmltext:convert-to-richtext of the bundle EzPlatformXmlTextFieldTypeBundle.

          I have the following error with a lot of inputs return by the validator :
          Error in 0:0: Element section has extra content: para

          An example of input :
          {quote}
          <?xml version="1.0" encoding="utf-8"?>\n
          <section
          xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
          xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
          xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
          <paragraph>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</paragraph>
          <paragraph>(Nous fournir la source du flash SVP)</paragraph>
          <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/">
          <literal class="html">...</literal>
          </paragraph>
          </section>
          {quote}

          The xml output by the convert :
          {quote}
          <section
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml"
          xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0">
          <para>Consultez la carte ci dessous pour les informations trafic autoroutier en temps réel.</para>
          <para>(Nous fournir la source du flash SVP)</para>
          ...
          </section>
          {quote}

          The following error can also appear :
          Error in 0:0: Element section has extra content: informaltable

          More examples that end up with informaltable and para errors can be found in the attached XML files.
          Konrad Oboza made changes -
          Status Confirmed [ 10037 ] InputQ [ 10001 ]
          Konrad Oboza made changes -
          Link This issue relates to CS-6884 [ CS-6884 ]
          Hide
          André Rømcke added a comment - - edited

          Here is suggested tag for migration for instance literal with custom attribute language set to php.

          <programlisting language="php">
          <![CDATA[
          $location = $repo->loadLocation( 44 );
          ]]>
           
          </programlisting>
          

          For Html5 (editor and output) that will become:

          <pre language="php">
          $location = $repo->loadLocation( 44 );
          </pre>
          

          See: https://tdg.docbook.org/tdg/5.1/programlisting.html

          However for class="html" we need to do something different, as it implies a different use case.
          One option which seems consistent with other tags is to use role="" attribute, for instance with value "raw":

          <programlisting language="html" role="raw">
          <![CDATA[
          <script>
          alert("Hello I'm an alert, and potentially a XSS attack if you don't limit usage of this!");
          </script>
          ]]>
           
          </programlisting>
          

          in this case for output, it will be the raw output.

          Other we could considered is custom tag. However programlisting is specific for this, including support for <![CDATA[ which we need here, and I'm not sure we can use this on custom tag without some extra work(??). And it will allow us to easily map to <pre> tag from html5 formats which is supported by Alloy.

          Show
          André Rømcke added a comment - - edited Here is suggested tag for migration for instance literal with custom attribute language set to php. <programlisting language="php"> <![CDATA[ $location = $repo->loadLocation( 44 ); ]]>   </programlisting> For Html5 (editor and output) that will become: <pre language="php"> $location = $repo->loadLocation( 44 ); </pre> See: https://tdg.docbook.org/tdg/5.1/programlisting.html However for class="html" we need to do something different, as it implies a different use case. One option which seems consistent with other tags is to use role="" attribute, for instance with value "raw": <programlisting language="html" role="raw"> <![CDATA[ <script> alert("Hello I'm an alert, and potentially a XSS attack if you don't limit usage of this!"); </script> ]]>   </programlisting> in this case for output, it will be the raw output. Other we could considered is custom tag. However programlisting is specific for this, including support for <![CDATA[ which we need here, and I'm not sure we can use this on custom tag without some extra work(??). And it will allow us to easily map to <pre> tag from html5 formats which is supported by Alloy.
          Hide
          André Rømcke added a comment -

          For the last case it might be preferable to use custom tag, where we define that it can contain <![CDATA[ to keep it separated from the first case which is more a normal <pre> case. It would make it easier to enable / disable the feature as a custom tag.

          Show
          André Rømcke added a comment - For the last case it might be preferable to use custom tag, where we define that it can contain <![CDATA[ to keep it separated from the first case which is more a normal <pre> case. It would make it easier to enable / disable the feature as a custom tag.
          Hide
          Vidar Langseid added a comment -

          I agree to use a custom tag for the `class="html"` use-case since using the tag "<programlisting> for that is just wrong (as the tagname implies).. It is not listing of code....

          Show
          Vidar Langseid added a comment - I agree to use a custom tag for the `class="html"` use-case since using the tag "<programlisting> for that is just wrong (as the tagname implies).. It is not listing of code....
          Hide
          Vidar Langseid added a comment - - edited

          How should the custom tag for class="html" look like?
          Something like this?

          <ezcustom:html>
          <![CDATA[
          <script>
          alert("Hello I'm an alert, and potentially a XSS attack if you don't limit usage of this!");
          </script>
          ]]>
          </ezcustom:html>
          

          edit : changed tagname, first proposal was just wrong...
          edit: This is based on who the youtube custom tag is translated

          Show
          Vidar Langseid added a comment - - edited How should the custom tag for class="html" look like? Something like this? <ezcustom:html> <![CDATA[ <script> alert("Hello I'm an alert, and potentially a XSS attack if you don't limit usage of this!"); </script> ]]> </ezcustom:html> edit : changed tagname, first proposal was just wrong... edit: This is based on who the youtube custom tag is translated
          Hide
          André Rømcke added a comment -

          Yes, this would be somewhat how it should look in docbook assuming this is inline with other block custom tags.

          SIDE: For html5 format for editor we might want to transform `<![CDATA[` to `<pre>` inside the custom tag so editor can edit the source as intended.

          Show
          André Rømcke added a comment - Yes, this would be somewhat how it should look in docbook assuming this is inline with other block custom tags. SIDE: For html5 format for editor we might want to transform `<![CDATA[` to `<pre>` inside the custom tag so editor can edit the source as intended.
          Hide
          Vidar Langseid added a comment -

          Other custom tags we support (like "factbox", is converted using <template> though...
          It would then look like this:

          <eztemplate name="html">
            <ezcontent>
          <![CDATA[
          <script>
          alert("Hello I'm an alert, and potentially a XSS attack if you don't limit usage of this!");
          </script>
          ]]></ezcontent>
          </eztemplate>
          

          FYI : example of factbox equalent in docbook:

            <eztemplate name="factbox" ezxhtml:class="templateClass" ezxhtml:align="left">
              <ezcontent>
                <table title="tableTitle">
                  <caption>About factoids</caption>
                  <tbody>
                    <tr>
                      <th>
                        <title ezxhtml:level="3" ezxhtml:textalign="center">Some facts about factoids</title>
                      </th>
                    </tr>
                    <tr>
                      <td>
                        <para>A factoid is a questionable or spurious (unverified, false, or fabricated) statement presented as a fact, but without supporting evidence.</para>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <para>Factoids may give rise to, or arise from, common misconceptions and urban legends.</para>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </ezcontent>
              <ezconfig>
                <ezvalue key="title">Factoids</ezvalue>
              </ezconfig>
            </eztemplate>

          Show
          Vidar Langseid added a comment - Other custom tags we support (like "factbox", is converted using <template> though... It would then look like this: <eztemplate name="html"> <ezcontent> <![CDATA[ <script> alert("Hello I'm an alert, and potentially a XSS attack if you don't limit usage of this!"); </script> ]]></ezcontent> </eztemplate> FYI : example of factbox equalent in docbook: <eztemplate name="factbox" ezxhtml:class="templateClass" ezxhtml:align="left"> <ezcontent> <table title="tableTitle"> <caption>About factoids</caption> <tbody> <tr> <th> <title ezxhtml:level="3" ezxhtml:textalign="center">Some facts about factoids</title> </th> </tr> <tr> <td> <para>A factoid is a questionable or spurious (unverified, false, or fabricated) statement presented as a fact, but without supporting evidence.</para> </td> </tr> <tr> <td> <para>Factoids may give rise to, or arise from, common misconceptions and urban legends.</para> </td> </tr> </tbody> </table> </ezcontent> <ezconfig> <ezvalue key="title">Factoids</ezvalue> </ezconfig> </eztemplate>
          André Rømcke made changes -
          Summary EzXmlText to RichText validation error : Element section has extra content EzXmlText to RichText validation error : Element section has extra content on <literal> tag
          André Rømcke made changes -
          Assignee Vidar Langseid [ vidar.langseid@ez.no ]
          Hide
          André Rømcke added a comment -

          Fix has been merged and released in 1.8.x version of ezplatform-xmltext-fieldtype package, which at time of writing can be used with eZ Platform 2.2 and higher. It will also work with 1.13 once v1.13.6 is out.

          Show
          André Rømcke added a comment - Fix has been merged and released in 1.8.x version of ezplatform-xmltext-fieldtype package, which at time of writing can be used with eZ Platform 2.2 and higher. It will also work with 1.13 once v1.13.6 is out.
          André Rømcke made changes -
          Assignee Vidar Langseid [ vidar.langseid@ez.no ]
          Status InputQ [ 10001 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Confirmed Confirmed
          112d 33m 1 Konrad Oboza 16/Jul/18 4:04 PM
          Confirmed Confirmed InputQ InputQ
          6m 16s 1 Konrad Oboza 16/Jul/18 4:10 PM
          InputQ InputQ Closed Closed
          153d 22h 41m 1 André Rømcke 17/Dec/18 1:52 PM

            People

            • Assignee:
              Unassigned
              Reporter:
              Faïsse Valentin
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: