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 523004 - schema validation versus a smil document
schema validation versus a smil document
Status: RESOLVED INVALID
Product: libxml2
Classification: Platform
Component: xmlschema
2.6.31
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-03-17 17:25 UTC by Alberto
Modified: 2019-09-16 14:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example of a smil document to run the test (582 bytes, application/xml)
2008-03-18 14:18 UTC, Alberto
Details

Description Alberto 2008-03-17 17:25:57 UTC
Please describe the problem:
I need to validate a smil document with the xml schema published by W3C ("http://www.w3.org/2001/SMIL20/smil20.xsd"). I use the interface to the XML Schemas of LibXml2 and it returns several parse errors about the smil xml schema document.

Steps to reproduce:
I write the piece of code I used (I started from example files present in www.xmlsoft.org):

static void
streamFile(const char *filename) {
    xmlTextReaderPtr reader;
    int ret;


    /*
     * Pass some special parsing options to activate DTD attribute defaulting,
     * entities substitution and DTD validation
     */
    reader = xmlNewTextReaderFilename(filename);
    if (reader != NULL) {
        ret = xmlTextReaderRead(reader);
        while (ret == 1) {
            processNode(reader);
            ret = xmlTextReaderRead(reader);
        }
        xmlSchemaParserCtxt* schemaParser = xmlSchemaNewParserCtxt("http://www.w3.org/2001/SMIL20/smil20.xsd");
        if (schemaParser) {
                xmlSchema* schema = xmlSchemaParse(schemaParser);
                if (schema) {
                        xmlSchemaValidCtxt* validityContext = xmlSchemaNewValidCtxt(schema);
                        if (validityContext) {

                                 // Returns 0 if validation succeeded
                                int result = xmlSchemaValidateFile(validityContext, filename, 0) == 0;
                                xmlSchemaFreeValidCtxt(validityContext);
                        }
                        xmlSchemaFree(schema);
                }
                xmlSchemaFreeParserCtxt(schemaParser);
        }
    } else {
        fprintf(stderr, "Unable to open %s\n", filename);
    }
}


Actual results:
Parser displays these errors:

http://www.w3.org/2001/SMIL20/smil20-layout.xsd:206: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:207: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:208: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:209: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:210: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.


Expected results:
No errors about the xml schema.

Does this happen every time?
yes.

Other information:
I first tried with a simple xml schema written in a local file and all worked fine.
Comment 1 Daniel Veillard 2008-03-18 12:32:31 UTC
Provide a minimal test case reproducing the problem please with xmllint.
There is no way I will ever get time to analyze your code, the SMIL XSD
and guess what kind of instance you may have used.

Daniel 
Comment 2 Alberto 2008-03-18 14:16:48 UTC
(In reply to comment #1)
> Provide a minimal test case reproducing the problem please with xmllint.
> There is no way I will ever get time to analyze your code, the SMIL XSD
> and guess what kind of instance you may have used.
> 
> Daniel 
> 

OK Daniel,
excuse me. For me it's the first time I submitted a bug here.

First of all, "xmllint --version":
xmllint: using libxml version 20631
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib

Then, I used "xmllint" in this way:
xmllint --schema "http://www.w3.org/2001/SMIL20/smil20.xsd" smil_example.xml

And the errors while loading the smil xml schema are:
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:206: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:207: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:208: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:209: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
http://www.w3.org/2001/SMIL20/smil20-layout.xsd:210: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'http://www.w3.org/2001/SMIL20/Language' are not allowed, since not indicated by an import statement.
WXS schema http://www.w3.org/2001/SMIL20/smil20.xsd failed to compile

I attach the xml sample file "smil_example.xml".

Best regards.
Alberto
Comment 3 Alberto 2008-03-18 14:18:54 UTC
Created attachment 107534 [details]
Example of a smil document to run the test
Comment 4 Daniel Veillard 2008-03-18 14:46:24 UTC
No idea if it's a bug in libxml2 or not.
smil20.xsd includes smil20-layout.xsd around line 22
smil20-layout.xsd uses a reference to a namespaced type
the bindings seems to be done with import statements in
smil20.xsd but after the include.
I don't understand the XSD Part 1 spec, I have no idea
if it's legal to bind to something which was not imported yet
at that point.
If you understand the XSD spec, please point me to the explanations
that's welcome ! If you don't understand it, may I suggest using 
something which actually has a clar semantic like Relax-NG,

  thanks,

Daniel  
Comment 5 Alberto 2008-03-20 07:21:38 UTC
Hi Daniel,

I'm not a XSD expert so I wrote to W3C about this problem.
As soon as they reply, I'll report to you the answer.

Alberto
Comment 6 Alberto 2008-05-15 06:22:42 UTC
Hi Daniel,

finally I received an answer from W3C. They confirmed me that there is a problem in the xml schema definition:
>>> I have verifyed the XML Schema for SMIL 2.0. (http://www.w3.org/2001/SMIL20/smil20.xsd 
>>> )
>>>
>>> The schema is NOT correct.
>>>
>>> So, by far, the best thing to do is to work with the SMIL 2.1 DTD.
>>> 

So, this is not a LibXml2 bug.
Sorry for opened this bug.

Thanks for the support.

Alberto