diff options
Diffstat (limited to 'l10ntools/source/helper.hxx')
-rw-r--r-- | l10ntools/source/helper.hxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/l10ntools/source/helper.hxx b/l10ntools/source/helper.hxx index cc33b71ff8ac..1e28aa6c4d50 100644 --- a/l10ntools/source/helper.hxx +++ b/l10ntools/source/helper.hxx @@ -35,6 +35,8 @@ #include <algorithm> #include <cassert> +#include <libxml/parser.h> + #include "rtl/string.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -100,6 +102,24 @@ inline sal_Int32 indexOfAnyAsciiL( return -1; } +inline bool isWellFormedXML( OString const & text ) +{ + xmlDocPtr doc; + OString content; + bool result = true; + + content = "<root>"; + content += text; + content += "</root>"; + doc = xmlParseMemory(content.getStr(),(int)content.getLength()); + if (doc == NULL) { + result = false; + } + xmlFreeDoc(doc); + xmlCleanupParser(); + return result; +} + template< typename T > inline T abbreviate( T const & text, sal_Int32 start, sal_Int32 length) { |