summaryrefslogtreecommitdiff
path: root/libs/xml.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-17 19:56:14 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-17 19:56:14 +0200
commit3402cba0fe6fa1b89a029c612b622e7a4771d901 (patch)
tree96a8eeccec970cdbf4efad3306698fb1196c9c2b /libs/xml.c
parent41ddcc70f6ac27688c0a7dccc975c4b72de718e2 (diff)
test setup to test for peppol validation
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 = {