summary refs log tree commit diff stats
path: root/lib/pure/parsexml.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/parsexml.nim')
-rw-r--r--lib/pure/parsexml.nim19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/pure/parsexml.nim b/lib/pure/parsexml.nim
index c49986087..667b8aed6 100644
--- a/lib/pure/parsexml.nim
+++ b/lib/pure/parsexml.nim
@@ -131,6 +131,10 @@ proc close*(my: var TXmlParser) {.inline.} =
   ## closes the parser `my` and its associated input stream.
   lexbase.close(my)
 
+proc kind*(my: TXmlParser): TXmlEventKind {.inline.} = 
+  ## returns the current event type for the XML parser
+  return my.kind
+
 proc charData*(my: TXmlParser): string {.inline.} = 
   ## returns the character data for the events: ``xmlCharData``, 
   ## ``xmlWhitespace``, ``xmlComment``, ``xmlCData``, ``xmlSpecial``
@@ -138,10 +142,6 @@ proc charData*(my: TXmlParser): string {.inline.} =
                      xmlSpecial})
   return my.a
 
-proc kind*(my: TXmlParser): TXmlEventKind {.inline.} = 
-  ## returns the current event type for the XML parser
-  return my.kind
-
 proc elementName*(my: TXmlParser): string {.inline.} = 
   ## returns the element name for the events: ``xmlElementStart``, 
   ## ``xmlElementEnd``, ``xmlElementOpen``
@@ -173,6 +173,16 @@ proc PIRest*(my: TXmlParser): string {.inline.} =
   assert(my.kind == xmlPI)
   return my.b
 
+proc rawData*(my: TXmlParser): string {.inline.} =
+  ## returns the underlying 'data' string by reference.
+  ## This is only used for speed hacks.
+  shallowCopy(result, my.a)
+
+proc rawData2*(my: TXmlParser): string {.inline.} =
+  ## returns the underlying second 'data' string by reference.
+  ## This is only used for speed hacks.
+  shallowCopy(result, my.b)
+
 proc getColumn*(my: TXmlParser): int {.inline.} = 
   ## get the current column the parser has arrived at.
   result = getColNumber(my, my.bufPos)
@@ -439,6 +449,7 @@ proc parseTag(my: var TXmlParser) =
     if my.buf[my.bufpos] == '/' and my.buf[my.bufpos+1] == '>':
       inc(my.bufpos, 2)
       my.state = stateEmptyElementTag
+      my.c = nil
     elif my.buf[my.bufpos] == '>':
       inc(my.bufpos)  
     else: