After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324164 - RelaxNG: "Extra element XXX in interleave"
RelaxNG: "Extra element XXX in interleave"
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: relaxng
2.6.16
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-12-15 11:33 UTC by Stephane Bortzmeyer
Modified: 2021-07-05 13:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stephane Bortzmeyer 2005-12-15 11:33:28 UTC
Please describe the problem:
xmllint refuses as invalid some XML files described by a RelaxNG schema when
this schema includes interleave. 



Steps to reproduce:
Here is a simplified version of the original problem, which still
demonstrates the bug.

The schema:

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="content"/>
  </start>
  <define name="content">
    <element name="content">
      <mixed>
        <oneOrMore>
          <element name="para">
            <interleave>
              <zeroOrMore>
                <ref name="inlines"/>
              </zeroOrMore>
              <zeroOrMore>
                <ref name="code"/>
              </zeroOrMore>
            </interleave>
          </element>
        </oneOrMore>
      </mixed>
    </element>
  </define>
  <define name="inlines">
    <interleave>
      <zeroOrMore>
        <ref name="link"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="emphasis"/>
      </zeroOrMore>
      <zeroOrMore>
        <text/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="code">
    <element name="code">
      <text/>
    </element>
  </define>
  <define name="emphasis">
    <element name="emphasis">
      <text/>
    </element>
  </define>
  <define name="link">
    <element name="link">
      <text/>
    </element>
  </define>
</grammar>

The test file:

<content>
<para>text
<code>foo</code>
text again
<code>bar</code>
</para>
</content>

Another test file which is accepted (because it only has one <code>
element):

<content>
<para>text
<code>foo</code>
text <emphasis>again</emphasis>
</para>
<para>Another para</para>
</content>

The command-line to show the bug:

xmllint --noout --relaxng schema.rng test.xml


Actual results:
test.xml:2: element para: Relax-NG validity error : Expecting an element got text
Relax-NG validity error : Extra element text in interleave
test.xml:2: element para: Relax-NG validity error : Element para failed to
validate content
test.xml fails to validate


Expected results:
A message "text.xml validates"


Does this happen every time?
Yes

Other information:

The jing validator or the nxml-mode editor have no problem so I believe this is
a bug in libxml2.
Comment 1 Daniel Veillard 2005-12-15 12:43:51 UTC
yes doing interleave of interleave is likely to trigger a known bug in 
libxml2 RNG code.

Daniel
Comment 2 Stephane Bortzmeyer 2006-01-04 14:19:26 UTC
rnv (http://ftp.davidashen.net/PreTI/RNV/) works fine too, so I agree this is a real bug in libxml2.
Comment 3 Tobias Minich 2008-01-27 23:03:05 UTC
Sorry to revive this old thing, but I seem to face a similar issue on 2.6.31. As long as the xml file is valid, everything works ok, so in this regard the bug seems gone. But the bug reappears as soon as the xml is invalid, giving the user a completely bogus error message.
Comment 4 GNOME Infrastructure Team 2021-07-05 13:26:27 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.