summaryrefslogtreecommitdiff
path: root/examples/elements.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/elements.c')
-rw-r--r--examples/elements.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/elements.c b/examples/elements.c
index e81d465..421a1ce 100644
--- a/examples/elements.c
+++ b/examples/elements.c
@@ -2,11 +2,22 @@
reads an XML document from standard input and writes a line with
the name of each element to standard output indenting child
elements by one tab stop more than their parent element.
+ It must be used with Expat compiled for UTF-8 output.
*/
#include <stdio.h>
#include "expat.h"
+#ifdef XML_LARGE_SIZE
+#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
+#define XML_FMT_INT_MOD "I64"
+#else
+#define XML_FMT_INT_MOD "ll"
+#endif
+#else
+#define XML_FMT_INT_MOD "l"
+#endif
+
static void XMLCALL
startElement(void *userData, const char *name, const char **atts)
{
@@ -45,7 +56,7 @@ main(int argc, char *argv[])
done = len < sizeof(buf);
if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {
fprintf(stderr,
- "%s at line %d\n",
+ "%s at line %" XML_FMT_INT_MOD "u\n",
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser));
return 1;