added a new API to split a QName without generating any memory allocation
* tree.c include/libxml/tree.h: added a new API to split a
QName without generating any memory allocation
* valid.c: fixed another problem with namespaces on element
in mixed content case
* python/tests/reader2.py: updated the testcase with
Bjorn Reese fix to reader for unsignificant white space
* parser.c HTMLparser.c: cleanup.
Daniel
diff --git a/tree.c b/tree.c
index 114989e..ca1a7bb 100644
--- a/tree.c
+++ b/tree.c
@@ -236,6 +236,43 @@
return(ret);
}
+/**
+ * xmlSplitQName3:
+ * @name: the full QName
+ * @len: an int *
+ *
+ * parse an XML qualified name string,i
+ *
+ * returns NULL if it is not a Qualified Name, otherwise, update len
+ * with the lenght in byte of the prefix and return a pointer
+ */
+
+const xmlChar *
+xmlSplitQName3(const xmlChar *name, int *len) {
+ int l = 0;
+
+ if (name == NULL) return(NULL);
+ if (len == NULL) return(NULL);
+
+ /* nasty but valid */
+ if (name[0] == ':')
+ return(NULL);
+
+ /*
+ * we are not trying to validate but just to cut, and yes it will
+ * work even if this is as set of UTF-8 encoded chars
+ */
+ while ((name[l] != 0) && (name[l] != ':'))
+ l++;
+
+ if (name[l] == 0)
+ return(NULL);
+
+ *len = l;
+
+ return(&name[l+1]);
+}
+
/************************************************************************
* *
* Check Name, NCName and QName strings *