From 3b0999969632e2820b846ca8adcef6b346ff7441 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Sun, 12 Dec 2004 19:53:30 +0000 Subject: 1.0-pre3 --- xml/xml.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'xml/xml.c') diff --git a/xml/xml.c b/xml/xml.c index 07dae8c..ebf7d00 100644 --- a/xml/xml.c +++ b/xml/xml.c @@ -16,6 +16,9 @@ enum { LOOK4START, // looking for first element start LOOK4TAG, // looking for element tag INTAG, // reading tag + INCOMMENT, // reading comment + LOOK4CEND1, // looking for second '-' in --> + LOOK4CEND2, // looking for '>' in --> LOOK4ATTRN, // looking for attr name, > or / INATTRN, // reading attr name LOOK4ATTRV, // looking for attr value @@ -149,7 +152,7 @@ XML::readChar(int c) { } break; } else { - if (c == '?' || c == '!') { + if (c == '?') { skipping = true; break; } @@ -159,6 +162,8 @@ XML::readChar(int c) { state = INTAG; } else if (c == '/') { state = LOOK4CLOSETAG; + } else if (c == '!') { + state = INCOMMENT; } else if (!isspace(c)) { if (parseerrorcb) { parseerrorcb(linenr, "Bogus tag char", c); @@ -183,6 +188,31 @@ XML::readChar(int c) { } break; + // reading comment + case INCOMMENT: + if (c == '-') { + state = LOOK4CEND1; + } + break; + + // looking for second '-' in "-->" + case LOOK4CEND1: + if (c == '-') { + state = LOOK4CEND2; + } else { + state = INCOMMENT; + } + break; + + // looking for '>' in "-->" + case LOOK4CEND2: + if (c == '>') { + state = LOOK4START; + } else if (c != '-') { + state = INCOMMENT; + } + break; + // looking for attr name, > or / case LOOK4ATTRN: if (c == '>') { -- cgit v1.2.3