]> git.mxchange.org Git - flightgear.git/commitdiff
catch one more syntax error and remove a stale debug printf
authorehofman <ehofman>
Mon, 27 Apr 2009 09:45:59 +0000 (09:45 +0000)
committerTim Moore <timoore@redhat.com>
Fri, 1 May 2009 22:44:21 +0000 (00:44 +0200)
utils/xmlgrep/xml.c

index a5e85e81046c3a76f3f1845d5905795d3cbc8cd9..1089423384b3ddd12bd013985e3a5febd6728a0f 100644 (file)
@@ -1547,6 +1547,14 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
         {
             if (!strncasecmp(new+1, element, elementlen))
             {
+                if (*(new+elementlen+1) != '>')
+                {
+                    *rlen = 0;
+                    *name = new+1;
+                    *len = XML_ELEMENT_NO_CLOSING_TAG;
+                    return 0;
+                }
+
                 if (found == num)
                 {
                    if (start_tag)
@@ -1564,7 +1572,9 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
                 }
                 found++;
             }
-            /* else proper closing tag not yet found, continue */
+            /* else proper closing tag not yet found, continue.     */
+            /* TODO: could be a bad match to the opening tag though */
+            /*       like: <test></teft>                            */
 
             new = memchr(cur, '>', restlen);
             if (!new)
@@ -1583,7 +1593,6 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
             *rlen = 0;
             *name = cur;
             *len = XML_ELEMENT_NO_CLOSING_TAG;
-printf("4\n");
             return 0;
         }
     }