B
bruce
hi paul...
in playing around with the test python app (see below) i've got a couple of
basic questions. i can't seem to find the answers via google, and when i've
looked in the libxml2dom stuff that i downloaded i didn't see answers
either...
for the list in the "for label in d.xpath" how can i find out the size of
the list???? a simple/basic question, but it's driving me up a wall!!!
also, how can i determine what methods are available for a libxml2dom
object?
thanks...
-bruce
sample code:
--------------------------------
--------------------------------#test python script
import libxml2dom
import urllib
print "hello"
turl =
"http://courses.tamu.edu/ViewSections.aspx?campus=CS&x=hvm4MX4PXIY9J8C2Dcxz5
0ncXTJdT7v2&type=M"
f = urllib.urlopen(turl)
s = f.read()
f.close()
# s contains HTML not XML text
d = libxml2dom.parseString(s, html=1)
# get the community-related links
for label in
d.xpath("/html/body/table/tr/td[2]/table/tr[6]/td/table/child::tr/td[@class=
'sectionheading']/text()"):
print label.nodeValue
print "/n/n/n/"
l =
d.xpath("/html/body/table/tr/td[2]/table/tr[6]/td/table/child::tr/td[@class=
'sectionheading']/text()")
print l[1].nodeValue
in playing around with the test python app (see below) i've got a couple of
basic questions. i can't seem to find the answers via google, and when i've
looked in the libxml2dom stuff that i downloaded i didn't see answers
either...
for the list in the "for label in d.xpath" how can i find out the size of
the list???? a simple/basic question, but it's driving me up a wall!!!
also, how can i determine what methods are available for a libxml2dom
object?
thanks...
-bruce
sample code:
--------------------------------
--------------------------------#test python script
import libxml2dom
import urllib
print "hello"
turl =
"http://courses.tamu.edu/ViewSections.aspx?campus=CS&x=hvm4MX4PXIY9J8C2Dcxz5
0ncXTJdT7v2&type=M"
f = urllib.urlopen(turl)
s = f.read()
f.close()
# s contains HTML not XML text
d = libxml2dom.parseString(s, html=1)
# get the community-related links
for label in
d.xpath("/html/body/table/tr/td[2]/table/tr[6]/td/table/child::tr/td[@class=
'sectionheading']/text()"):
print label.nodeValue
print "/n/n/n/"
l =
d.xpath("/html/body/table/tr/td[2]/table/tr[6]/td/table/child::tr/td[@class=
'sectionheading']/text()")
print l[1].nodeValue