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 157973 - Validate Schemata without XML document
Validate Schemata without XML document
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: xmlschema
2.6.14
Other All
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-11-11 16:53 UTC by Frans Englich
Modified: 2021-07-05 13:22 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Frans Englich 2004-11-11 16:53:44 UTC
Sometimes it may be of interest to ensure that ones XML Schema is valid, without
(trying to) use it to validate an XML document instance. Hypothetically, it
would be practical if:

xmllint --noout --schema schema.xsd

didn't return an usage error, but loaded the Schema and simply barfed if it
wasn't a (valid) Schema. The exact details of xmllint's arguments, is another
matter.

A relevant thread:
http://mail.gnome.org/archives/xml/2004-November/msg00084.html

Cheers,
       Frans
Comment 1 Frans Englich 2004-11-11 19:55:24 UTC
Also, the same is of interest for xsltproc; validating XSLTs, without having to
transform a document.


Cheers,

       Frans
Comment 2 Daniel Veillard 2004-11-11 20:37:45 UTC
for xsltproc, rejected, "xsltproc test.xml" already has a precise
definition.

Daniel
Comment 3 Frans Englich 2004-11-22 00:58:16 UTC
 
I bet I've broken more than I've fixed, but I quickly hacked together what is 
below. Works For Me. 
 
Index: xmllint.c 
=================================================================== 
RCS file: /cvs/gnome/libxml2/xmllint.c,v 
retrieving revision 1.133 
diff -u -3 -p -r1.133 xmllint.c 
--- xmllint.c   9 Nov 2004 16:16:59 -0000       1.133 
+++ xmllint.c   22 Nov 2004 00:55:33 -0000 
@@ -1669,10 +1669,12 @@ static void showVersion(const char *name 
 static void usage(const char *name) { 
     printf("Usage : %s [options] XMLfiles ...\n", name); 
 #ifdef LIBXML_OUTPUT_ENABLED 
-    printf("\tParse the XML files and output the result of the parsing\n"); 
+    printf("\tParse the XML files and output the result of the parsing.\n"); 
 #else 
-    printf("\tParse the XML files\n"); 
+    printf("\tParse the XML files.\n"); 
 #endif /* LIBXML_OUTPUT_ENABLED */ 
+    printf("\tIf no XML files are supplied but a W3C XML Schema is, a 
loading\n"); 
+    printf("\tis attempted and any errors encountered are reported.\n"); 
     printf("\t--version : display the version of the XML library used\n"); 
 #ifdef LIBXML_DEBUG_ENABLED 
     printf("\t--debug : dump a debug tree of the in-memory document\n"); 
@@ -2177,7 +2179,6 @@ main(int argc, char **argv) { 
            xmlGenericError(xmlGenericErrorContext, 
                    "WXS schema %s failed to compile\n", schema); 
             progresult = XMLLINT_ERR_SCHEMACOMP; 
-           schema = NULL; 
        } 
        xmlSchemaFreeParserCtxt(ctxt); 
        if (timing) { 
@@ -2294,7 +2295,7 @@ main(int argc, char **argv) { 
     if ((htmlout) && (!nowrap)) { 
        xmlGenericError(xmlGenericErrorContext, "</body></html>\n"); 
     } 
-    if ((files == 0) && (!generate) && (version == 0)) { 
+    if ((files == 0) && (schema == NULL) && (!generate) && (version == 0)) { 
        usage(argv[0]); 
     } 
 #ifdef LIBXML_SCHEMAS_ENABLED 
 
Comment 4 GNOME Infrastructure Team 2021-07-05 13:22:16 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.