From 3402cba0fe6fa1b89a029c612b622e7a4771d901 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Wed, 17 Sep 2025 19:56:14 +0200 Subject: test setup to test for peppol validation --- libs/xml.c/src/xml.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libs/xml.c') 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 = { -- cgit v1.2.3-70-g09d2