403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.145.186.83
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/reader5.py
#!/usr/bin/env python3
#
# this tests the Expand() API of the xmlTextReader interface
# this extract the Dragon bibliography entries from the XML specification
#
import setup_test
import libxml2
import os
import sys

# Memory debug specific
libxml2.debugMemory(1)

expect="""<bibl id="Aho" key="Aho/Ullman">Aho, Alfred V., 
Ravi Sethi, and Jeffrey D. Ullman.
<emph>Compilers:  Principles, Techniques, and Tools</emph>.
Reading:  Addison-Wesley, 1986, rpt. corr. 1988.</bibl>"""

basedir = os.path.dirname(os.path.realpath(__file__))
f = open(os.path.join(basedir, '../../test/valid/REC-xml-19980210.xml'), 'rb')
input = libxml2.inputBuffer(f)
reader = input.newTextReader("REC")
res=""
while reader.Read() > 0:
    while reader.Name() == 'bibl':
        node = reader.Expand()            # expand the subtree
        if node.xpathEval("@id = 'Aho'"): # use XPath on it
            res = res + node.serialize()
        if reader.Next() != 1:            # skip the subtree
            break;

if res != expect:
    print("Error: didn't get the expected output")
    print("got '%s'" % (res))
    print("expected '%s'" % (expect))
    

#
# cleanup
#
del input
del reader

# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
    print("OK")
else:
    print("Memory leak %d bytes" % (libxml2.debugMemory(1)))

Youez - 2016 - github.com/yon3zu
LinuXploit