File noxref.patch of Package libxml2

--- libxml2-2.7.7/valid.c.orig	2010-07-14 20:53:09.000000000 +0200
+++ libxml2-2.7.7/valid.c	2010-07-14 21:59:41.708128513 +0200
@@ -6469,10 +6469,16 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCt
     } else if (attr->atype == XML_ATTRIBUTE_IDREF) {
 	id = xmlGetID(ctxt->doc, name);
 	if (id == NULL) {
-	    xmlErrValidNode(ctxt, attr->parent, XML_DTD_UNKNOWN_ID,
-	   "IDREF attribute %s references an unknown ID \"%s\"\n",
-		   attr->name, name, NULL);
-	    ctxt->valid = 0;
+            if (ctxt->doc->parseFlags & XML_PARSE_NOXREF) {
+		xmlErrValidWarning(ctxt, attr->parent, XML_DTD_UNKNOWN_ID,
+	       "IDREF attribute %s references an unknown ID \"%s\"\n",
+		       attr->name, name, NULL);
+            } else {
+		xmlErrValidNode(ctxt, attr->parent, XML_DTD_UNKNOWN_ID,
+	       "IDREF attribute %s references an unknown ID \"%s\"\n",
+		       attr->name, name, NULL);
+		ctxt->valid = 0;
+            }
 	}
     } else if (attr->atype == XML_ATTRIBUTE_IDREFS) {
 	xmlChar *dup, *str = NULL, *cur, save;
--- libxml2-2.7.7/parser.c.orig	2010-03-15 10:11:40.000000000 +0100
+++ libxml2-2.7.7/parser.c	2010-07-14 21:53:25.903128498 +0200
@@ -14381,6 +14381,12 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtP
         ctxt->sax->fatalError = NULL;
         options -= XML_PARSE_NOERROR;
     }
+#ifdef LIBXML_VALID_ENABLED
+    if (options & XML_PARSE_NOXREF) {
+        options -= XML_PARSE_NOXREF;
+	ctxt->options |= XML_PARSE_NOXREF;
+    }
+#endif /* LIBXML_VALID_ENABLED */
 #ifdef LIBXML_SAX1_ENABLED
     if (options & XML_PARSE_SAX1) {
         ctxt->sax->startElement = xmlSAX2StartElement;
--- libxml2-2.7.7/include/libxml/parser.h.orig	2010-03-15 11:40:03.000000000 +0100
+++ libxml2-2.7.7/include/libxml/parser.h	2010-07-14 20:39:57.161550835 +0200
@@ -1106,7 +1106,8 @@ typedef enum {
     XML_PARSE_OLD10	= 1<<17,/* parse using XML-1.0 before update 5 */
     XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
     XML_PARSE_HUGE      = 1<<19, /* relax any hardcoded limit from the parser */
-    XML_PARSE_OLDSAX    = 1<<20 /* parse using SAX2 interface from before 2.7.0 */
+    XML_PARSE_OLDSAX    = 1<<20, /* parse using SAX2 interface from before 2.7.0 */
+    XML_PARSE_NOXREF	= 1<<21	 /* turn idref errors into warnings */
 } xmlParserOption;
 
 XMLPUBFUN void XMLCALL
--- libxml2-2.7.7/xmllint.c.orig	2010-07-14 20:31:34.000000000 +0200
+++ libxml2-2.7.7/xmllint.c	2010-07-14 20:44:16.940128662 +0200
@@ -141,6 +141,7 @@ static int oldout = 0;
 #endif /* LIBXML_OUTPUT_ENABLED */
 #ifdef LIBXML_VALID_ENABLED
 static int valid = 0;
+static int noxref = 0;
 static int postvalid = 0;
 static char * dtdvalid = NULL;
 static char * dtdvalidfpi = NULL;
@@ -2979,6 +2980,7 @@ static void usage(const char *name) {
     printf("\t--nowrap : do not put HTML doc wrapper\n");
 #ifdef LIBXML_VALID_ENABLED
     printf("\t--valid : validate the document in addition to std well-formed check\n");
+    printf("\t--noxref : turn IDREF linkend errors into warnings\n");
     printf("\t--postvalid : do a posteriori validation, i.e after parsing\n");
     printf("\t--dtdvalid URL : do a posteriori validation against a given DTD\n");
     printf("\t--dtdvalidfpi FPI : same but name the DTD with a Public Identifier\n");
@@ -3179,6 +3181,12 @@ main(int argc, char **argv) {
 	    postvalid++;
 	    loaddtd++;
 	    options |= XML_PARSE_DTDLOAD;
+	} else if ((!strcmp(argv[i], "-noxref")) ||
+	         (!strcmp(argv[i], "--noxref")) ||
+	         (!strcmp(argv[i], "-noidref")) ||
+	         (!strcmp(argv[i], "--noidref"))) {
+	    noxref++;
+	    options |= XML_PARSE_NOXREF;
 	} else if ((!strcmp(argv[i], "-dtdvalid")) ||
 	         (!strcmp(argv[i], "--dtdvalid"))) {
 	    i++;
openSUSE Build Service is sponsored by