Diff for /embedaddon/libxml2/python/tests/reader5.py between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:38:00 version 1.1.1.2, 2014/06/15 19:53:34
Line 4 Line 4
 # this extract the Dragon bibliography entries from the XML specification  # this extract the Dragon bibliography entries from the XML specification
 #  #
 import libxml2  import libxml2
 import StringIO  
 import sys  import sys
   
 # Memory debug specific  # Memory debug specific
Line 15  Ravi Sethi, and Jeffrey D. Ullman. Line 14  Ravi Sethi, and Jeffrey D. Ullman.
 <emph>Compilers:  Principles, Techniques, and Tools</emph>.  <emph>Compilers:  Principles, Techniques, and Tools</emph>.
 Reading:  Addison-Wesley, 1986, rpt. corr. 1988.</bibl>"""  Reading:  Addison-Wesley, 1986, rpt. corr. 1988.</bibl>"""
   
f = open('../../test/valid/REC-xml-19980210.xml')f = open('../../test/valid/REC-xml-19980210.xml', 'rb')
 input = libxml2.inputBuffer(f)  input = libxml2.inputBuffer(f)
 reader = input.newTextReader("REC")  reader = input.newTextReader("REC")
 res=""  res=""
while reader.Read():while reader.Read() > 0:
     while reader.Name() == 'bibl':      while reader.Name() == 'bibl':
         node = reader.Expand()            # expand the subtree          node = reader.Expand()            # expand the subtree
         if node.xpathEval("@id = 'Aho'"): # use XPath on it          if node.xpathEval("@id = 'Aho'"): # use XPath on it
Line 28  while reader.Read(): Line 27  while reader.Read():
             break;              break;
   
 if res != expect:  if res != expect:
    print "Error: didn't get the expected output"    print("Error: didn't get the expected output")
    print "got '%s'" % (res)    print("got '%s'" % (res))
    print "expected '%s'" % (expect)    print("expected '%s'" % (expect))
           
   
 #  #
Line 42  del reader Line 41  del reader
 # Memory debug specific  # Memory debug specific
 libxml2.cleanupParser()  libxml2.cleanupParser()
 if libxml2.debugMemory(1) == 0:  if libxml2.debugMemory(1) == 0:
    print "OK"    print("OK")
 else:  else:
    print "Memory leak %d bytes" % (libxml2.debugMemory(1))    print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
     libxml2.dumpMemory()      libxml2.dumpMemory()

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>