bugfix for parsexml module

This commit is contained in:
Andreas Rumpf 2010-01-21 20:01:16 +01:00
commit 20962ca50f
2 changed files with 8 additions and 2 deletions

View file

@ -1,7 +1,7 @@
# #
# #
# Nimrod's Runtime Library # Nimrod's Runtime Library
# (c) Copyright 2009 Andreas Rumpf # (c) Copyright 2010 Andreas Rumpf
# #
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
# distribution, for details about the copyright. # distribution, for details about the copyright.
@ -89,7 +89,7 @@ type
reportComments ## report comments reportComments ## report comments
TXmlParser* = object of TBaseLexer ## the parser object. TXmlParser* = object of TBaseLexer ## the parser object.
a, b: string a, b, c: string
kind: TXmlEventKind kind: TXmlEventKind
err: TXmlError err: TXmlError
state: TParserState state: TParserState
@ -424,6 +424,7 @@ proc parseTag(my: var TXmlParser) =
# an attribute follows: # an attribute follows:
my.kind = xmlElementOpen my.kind = xmlElementOpen
my.state = stateAttr my.state = stateAttr
my.c = my.a # save for later
else: else:
my.kind = xmlElementStart my.kind = xmlElementStart
if my.buf[my.bufpos] == '/' and my.buf[my.bufpos+1] == '>': if my.buf[my.bufpos] == '/' and my.buf[my.bufpos+1] == '>':
@ -597,6 +598,8 @@ proc next*(my: var TXmlParser) =
of stateEmptyElementTag: of stateEmptyElementTag:
my.state = stateNormal my.state = stateNormal
my.kind = xmlElementEnd my.kind = xmlElementEnd
if not isNil(my.c):
my.a = my.c
of stateError: of stateError:
my.kind = xmlError my.kind = xmlError
my.state = stateNormal my.state = stateNormal

View file

@ -104,5 +104,8 @@ sh build.sh</pre>
</div> </div>
</div> </div>
</body> </body>
<bugtest att="value" />
</html> </html>