summaryrefslogtreecommitdiff
path: root/libs/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/xml.c')
-rw-r--r--libs/xml.c/src/xml.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/xml.c/src/xml.c b/libs/xml.c/src/xml.c
index 4c4e6f2..9f8bf24 100644
--- a/libs/xml.c/src/xml.c
+++ b/libs/xml.c/src/xml.c
@@ -723,8 +723,8 @@ static struct xml_node* xml_parse_node(struct xml_parser* parser) {
original_length = tag_open->length;
attributes = xml_find_attributes(parser, tag_open);
- /* If tag ends with `/' it's self closing, skip content lookup */
- if (tag_open->length > 0 && '/' == tag_open->buffer[original_length - 1]) {
+ /* If tag ends with `/' or '?' it's self closing, skip content lookup */
+ if (tag_open->length > 0 && (('/' == tag_open->buffer[original_length - 1]) || ('-' == tag_open->buffer[original_length - 1]))) {
/* Drop `/'
*/
goto node_creation;
@@ -828,6 +828,12 @@ exit_failure:
*/
struct xml_document* xml_parse_document(uint8_t* buffer, size_t length) {
+ char *tagEnd = strstr((char*)buffer, "?>");
+ if (tagEnd) {
+ length -= (size_t)((tagEnd-(char*)buffer)+2);
+ buffer = (uint8_t*)(tagEnd+2);
+ }
+
/* Initialize parser
*/
struct xml_parser parser = {