mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 21:22:09 +00:00
[core] remember if a tag is parsed from CDATA
This commit is contained in:
@@ -69,7 +69,8 @@ SWITCH_BEGIN_EXTERN_C
|
||||
SWITCH_XML_ROOT = (1 << 0), // root
|
||||
SWITCH_XML_NAMEM = (1 << 1), // name is malloced
|
||||
SWITCH_XML_TXTM = (1 << 2), // txt is malloced
|
||||
SWITCH_XML_DUP = (1 << 3) // attribute name and value are strduped
|
||||
SWITCH_XML_DUP = (1 << 3), // attribute name and value are strduped
|
||||
SWITCH_XML_CDATA = (1 << 4) // body is in CDATA
|
||||
} switch_xml_flag_t;
|
||||
|
||||
/*! \brief A representation of an XML tree */
|
||||
|
||||
+6
-2
@@ -1139,10 +1139,14 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len)
|
||||
if (!(s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) || (!*s && e != '>'))
|
||||
return switch_xml_err(root, d, "unclosed <!--");
|
||||
} else if (!strncmp(s, "![CDATA[", 8)) { /* cdata */
|
||||
if ((s = strstr(s, "]]>")))
|
||||
if ((s = strstr(s, "]]>"))) {
|
||||
if (root && root->cur) {
|
||||
root->cur->flags |= SWITCH_XML_CDATA;
|
||||
}
|
||||
switch_xml_char_content(root, d + 8, (s += 2) - d - 10, 'c');
|
||||
else
|
||||
} else {
|
||||
return switch_xml_err(root, d, "unclosed <![CDATA[");
|
||||
}
|
||||
} else if (!strncmp(s, "!DOCTYPE", 8)) { /* dtd */
|
||||
for (l = 0; *s && ((!l && *s != '>') || (l && (*s != ']' || *(s + strspn(s + 1, SWITCH_XML_WS) + 1) != '>'))); l = (*s == '[') ? 1 : l)
|
||||
s += strcspn(s + 1, "[]>") + 1;
|
||||
|
||||
Reference in New Issue
Block a user