diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2010-01-21 20:01:16 +0100 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2010-01-21 20:01:16 +0100 |
commit | 20962ca50fe62268e40539056f8604018f5a49bd (patch) | |
tree | 1845ac6dff45edb34e7ab6217a15320352751deb | |
parent | 0ea4b71eec1fc2b738b203e4196f281be49d6aae (diff) | |
download | Nim-20962ca50fe62268e40539056f8604018f5a49bd.tar.gz |
bugfix for parsexml module
-rwxr-xr-x | lib/pure/parsexml.nim | 7 | ||||
-rwxr-xr-x | tests/xmltest.html | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/pure/parsexml.nim b/lib/pure/parsexml.nim index 54f62a9a4..7184e6c45 100755 --- a/lib/pure/parsexml.nim +++ b/lib/pure/parsexml.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2009 Andreas Rumpf +# (c) Copyright 2010 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -89,7 +89,7 @@ type reportComments ## report comments TXmlParser* = object of TBaseLexer ## the parser object. - a, b: string + a, b, c: string kind: TXmlEventKind err: TXmlError state: TParserState @@ -424,6 +424,7 @@ proc parseTag(my: var TXmlParser) = # an attribute follows: my.kind = xmlElementOpen my.state = stateAttr + my.c = my.a # save for later else: my.kind = xmlElementStart if my.buf[my.bufpos] == '/' and my.buf[my.bufpos+1] == '>': @@ -597,6 +598,8 @@ proc next*(my: var TXmlParser) = of stateEmptyElementTag: my.state = stateNormal my.kind = xmlElementEnd + if not isNil(my.c): + my.a = my.c of stateError: my.kind = xmlError my.state = stateNormal diff --git a/tests/xmltest.html b/tests/xmltest.html index 862a91d24..ca4abc4eb 100755 --- a/tests/xmltest.html +++ b/tests/xmltest.html @@ -104,5 +104,8 @@ sh build.sh</pre> </div> </div> </body> + + <bugtest att="value" /> + </html> |