#367129 Namespace lost during schema validation

Package:
libxml2
Source:
libxml2
Description:
GNOME XML library
Submitter:
Date:
2021-07-05 18:33:03 UTC
Severity:
normal
Tags:
#367129#5
Date:
2006-05-13 22:03:28 UTC
From:
To:
The following example reprocuces the problem
test.xsd-------------------------------------------------------------------------
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://heute-morgen.de/namespaces/sqil"
  xmlns:sqil="http://heute-morgen.de/namespaces/sqil"

  <!-- Types -->
  <!-- Most sqil elements have a name -->
  <xs:complexType name="namedEmptyElement">
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="conditional">
    <xs:complexContent mixed="true">
      <xs:extension base="sqil:namedEmptyElement">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="bind" type="sqil:namedEmptyElement"/>
        </xs:choice>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- We need the root element -->
  <xs:element name="sqil"/>

  <xs:element name="bind" type="sqil:namedEmptyElement"/>

  <xs:element name="if-exists" type="sqil:conditional"/>

</xs:schema>
bug.sqil-------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<sqil:sqil xmlns:sqil="http://heute-morgen.de/namespaces/sqil">

      WHERE 1=1
      <sqil:if-exists name="agent">
        AND al.agent=<sqil:bind  name="agent"/>
      </sqil:if-exists>

</sqil:sqil>
TEST-------------------------------------------------------------------------
jo@asus:$ xmllint --noout --schema test.xsd bug.sqil
bug.sqil:6: element bind: Schemas validity error : Element
'{http://heute-morgen.de/namespaces/sqil}bind': This element is not
expected. Expected is ( bind ).
bug.sqil fails to validate
-------------------------------------------------------------------------

As far as I understand it, a bind tag in the sqil namespace should be
expected and no error should be generated.

Sincerely,
Joachim

#367129#14
Date:
2017-02-20 14:09:37 UTC
From:
To:
Hi.

This bug still seems to be valid. (or is valid again?)

The upstream bug is still in stage "NEW".

Attached is a far simpler example, which triggers the bug.

"bugged.xsd" is a schema, that should validate "test.xml", but does not.
"workaround.xsd" is an equivalent schema, which does validate the
"test.xml" file.

It seems people either do not design their schemas the "bugged" way.

If anyone is interested, the schema that triggered this bug for me in
the first place is this one: http://www.omg.org/spec/XMI/20131001/XMI.xsd

Regards
  Andre