Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2823

XML Schema file is invalid since 5.3

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 5.4, 5.3.12
    • 5.3, 5.4
    • None
    • False
    • None
    • False
    • Moderate

      Changes made in JGRP-2764 seem to have made the JGroups XML Schema invalid.

      For example, using a simple configuration file like:

      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups-5.3.xsd"
              xmlns="urn:org:jgroups">
       <BPING/>
      </config>

      When I try to validate it using xmllint:

      $ xmllint --nowarning --noout --schema jgroups-5.3.xsd jgroups-test.xml 
      jgroups-5.3.xsd:1500: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'fork' are not allowed, since not indicated by an import statement.
      jgroups-5.3.xsd:7084: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'urn:jgroups:relay:1.0' are not allowed, since not indicated by an import statement.
      jgroups-5.3.xsd:7188: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'urn:jgroups:relay:1.0' are not allowed, since not indicated by an import statement.
      WXS schema jgroups-5.3.xsd failed to compile

      If I slightly modify jgroups-5.3.xsd like this:

      $ diff -u jgroups-5.3.xsd jgroups-5.3-modified.xsd
      --- jgroups-5.3.xsd    2024-03-01 09:25:22.000000000 +0100
      +++ jgroups-5.3-modified.xsd    2024-08-19 10:41:30.391664175 +0200
      @@ -1497,7 +1497,7 @@
             <xs:element name="FORK">
               <xs:complexType>
                 <xs:choice maxOccurs="unbounded" minOccurs="0">
      -            <xs:element name="fork-stacks" type="fork:ForkStacksType"/>
      +            <xs:element name="fork-stacks" type="tns:ForkStacksType"/>
                 </xs:choice>
                 <xs:attribute name="after_creation_hook" type="xs:string">
                   <xs:annotation>
      @@ -7081,7 +7081,7 @@
             <xs:element name="relay.RELAY2">
               <xs:complexType>
                 <xs:choice maxOccurs="unbounded" minOccurs="0">
      -            <xs:element name="RelayConfiguration" type="relay:RelayConfigurationType"/>
      +            <xs:element name="RelayConfiguration" type="tns:RelayConfigurationType"/>
                 </xs:choice>
                 <xs:attribute name="after_creation_hook" type="xs:string">
                   <xs:annotation>
      @@ -7185,7 +7185,7 @@
             <xs:element name="relay.RELAY3">
               <xs:complexType>
                 <xs:choice maxOccurs="unbounded" minOccurs="0">
      -            <xs:element name="RelayConfiguration" type="relay:RelayConfigurationType"/>
      +            <xs:element name="RelayConfiguration" type="tns:RelayConfigurationType"/>
                 </xs:choice>
                 <xs:attribute name="after_creation_hook" type="xs:string">
                   <xs:annotation>

      I can then validate the file successfully:

      $ xmllint --nowarning --noout --schema jgroups-5.3-modified.xsd jgroups-test.xml
      jgroups-test.xml validates

       

      Tools other than xmllint show the same issue by the way:

      $ python3
      >>> with open('jgroups-5.3.xsd', 'rb') as f:
      ...     root=etree.XML(f.read())
      ...     s=etree.XMLSchema(root)
      ... ^D
      Traceback (most recent call last):
        File "<stdin>", line 3, in <module>
        File "src/lxml/xmlschema.pxi", line 90, in lxml.etree.XMLSchema._init_
      lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'fork' are not allowed, since not indicated by an import statement., line 1500

       

       

              rhn-engineering-bban Bela Ban
              dalbani Damiano Albani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: