summaryrefslogtreecommitdiff
path: root/libs/xml.c/src
diff options
context:
space:
mode:
Diffstat (limited to 'libs/xml.c/src')
-rw-r--r--libs/xml.c/src/xml.c10
-rw-r--r--libs/xml.c/src/xml.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/libs/xml.c/src/xml.c b/libs/xml.c/src/xml.c
index 0a93e57..6d14213 100644
--- a/libs/xml.c/src/xml.c
+++ b/libs/xml.c/src/xml.c
@@ -820,7 +820,15 @@ exit_failure:
}
-
+bool xml_string_is_valid(uint8_t* buffer, size_t length)
+{
+ struct xml_document* doc = xml_parse_document(buffer, length);
+ if (!doc) {
+ return 0;
+ }
+ xml_document_free(doc, false);
+ return 1;
+}
/**
diff --git a/libs/xml.c/src/xml.h b/libs/xml.c/src/xml.h
index 65a7b9f..ef8d55c 100644
--- a/libs/xml.c/src/xml.h
+++ b/libs/xml.c/src/xml.h
@@ -64,7 +64,7 @@ struct xml_string;
* @return The parsed xml fragment iff parsing was successful, 0 otherwise
*/
struct xml_document* xml_parse_document(uint8_t* buffer, size_t length);
-
+bool xml_string_is_valid(uint8_t* buffer, size_t length);
/**