diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2004-10-19 12:39:34 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2004-10-19 12:39:34 +0000 |
commit | a924ce5806846d20c0766faa86d846c21b83368d (patch) | |
tree | 3c1a006de87b53d7483e0876502c2cb815b8a48b /src/ne_xml.c | |
parent | 94b47740c6a03ca98115227c929bc2155ad99119 (diff) | |
download | neon-a924ce5806846d20c0766faa86d846c21b83368d.tar.gz |
* src/ne_xml.c (invalid_ncname): Factor out macro for NCName
checking.
(declare_nspaces): Use invalid_ncname macro. Don't compare 'xmlns'
case-insensitively.
(expand_qname): Use invalid_ncname macro.
* test/xml.c (fail_match): Skip correct checks for the time being.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@325 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'src/ne_xml.c')
-rw-r--r-- | src/ne_xml.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ne_xml.c b/src/ne_xml.c index 008f1d6..a0c67a9 100644 --- a/src/ne_xml.c +++ b/src/ne_xml.c @@ -205,6 +205,11 @@ const char *ne_xml_doc_encoding(const ne_xml_parser *p) /* Return non-zero if 'ch' is an invalid start character for an NCName: */ #define invalid_ncname_ch1(ch) ((ch) == '\0' || strchr("-.0123456789", (ch)) != NULL) +/* Subversion repositories have been deployed which use property names + * marshalled as NCNames including a colon character; these should + * also be rejected but will be allowed for the time being. */ +#define invalid_ncname(xn) (invalid_ncname_ch1((xn)[0])) + /* Extract the namespace prefix declarations from 'atts'. */ static int declare_nspaces(ne_xml_parser *p, struct element *elm, const ne_xml_char **atts) @@ -212,19 +217,15 @@ static int declare_nspaces(ne_xml_parser *p, struct element *elm, int n; for (n = 0; atts && atts[n]; n += 2) { - if (strcasecmp(atts[n], "xmlns") == 0) { + if (strcmp(atts[n], "xmlns") == 0) { /* New default namespace */ elm->default_ns = ne_strdup(atts[n+1]); - } else if (strncasecmp(atts[n], "xmlns:", 6) == 0) { + } else if (strncmp(atts[n], "xmlns:", 6) == 0) { struct namespace *ns; /* Reject some invalid NCNames as namespace prefix, and an * empty URI as the namespace URI */ - if (invalid_ncname_ch1(atts[n][6]) || atts[n+1][0] == '\0' -#if 0 /* SVN has widely-deployed names using ':' so avoid breaking these */ - || strchr(atts[n] + 6, ':') != NULL -#endif - ) { + if (invalid_ncname(atts[n] + 6) || atts[n+1][0] == '\0') { ne_snprintf(p->error, ERR_SIZE, ("XML parse error at line %d: invalid namespace " "declaration"), ne_xml_currentline(p)); @@ -261,8 +262,7 @@ static int expand_qname(ne_xml_parser *p, struct element *elm, elm->name = ne_strdup(qname); elm->nspace = e->default_ns; - } else if (invalid_ncname_ch1(pfx[1]) || qname == pfx || - strchr(pfx+1, ':') != NULL) { + } else if (invalid_ncname(pfx + 1) || qname == pfx) { ne_snprintf(p->error, ERR_SIZE, _("XML parse error at line %d: invalid element name"), ne_xml_currentline(p)); |