Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet290/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   286   287   288   289   290   291   292   293   ...   453
280

CHAPTER 13
Working With XML Data
FIgURE 13-5: 
The XMLUtil.Walk() function is interesting because it provides a generator.
The third call to 
Walk()
begins processing of the 
root
node. It’s interesting to trace through the code 
in the debugger because you see the 
for
loops in 
XMLUtil.Walk()
used to trace through each element 
of the input 
xml
as if it were using recursion or perhaps some type of iteration, but the fact is that 
the code merely combines the 
for
loop with a yield statement to feed each partial result back to the 
requestor. Using the Python debugger is actually a bit more helpful in this case than using the Visual 
Studio debugger because the Visual Studio debugger won’t show you the value of 
xml

child
, or 
c
so 
that you can see the changing values. The example code for this book includes 
XMLUtilDemo2.py
for 
the purpose of using the Python debugger. Follow these steps to load the debugger so you can trace 
through the example yourself.
1.
Open the IronPython console.
2.
Type 
import sys
and press Enter. This command imports the 
sys
module so that you can 
add the required directory to it.
3.
Type 
sys.path.append(‘C:/Program Files/IronPython 2.6/Tutorial‘)
and press 
Enter (make sure you change the path information to match the location of your IronPython 
installation).
4.
Type 
import XMLUtil
and press Enter to import the support file (important if you want to 
see how the generator works).
5.
Type 
import XMLUtilDemo2
and press Enter to import the source code file.
6.
Type 
import pdb
and press Enter to import the debugger.
7.
Type 
pdb.run(‘XMLUtilDemo2.main()‘)
to start the debugger. At this point, you can 
single step through the code to see how everything works. The “Debugging with the Python 
Debugger” section of Chapter 12 provides additional details.
548592c13.indd 280
2/24/10 12:48:59 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   286   287   288   289   290   291   292   293   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish