xpath question...

bruce bedouglas at earthlink.net
Sun Jul 9 00:55:09 EDT 2006


hi...

i have the following section of test code where i'm trying to get the
attribute of a frame
   <frame  src="....">

i'm trying to print/get the src value. the xpath query that i have displays
the "src" attribute in the Xpather/Firefox plugin. however, i can't quite
figure out how to get the underlying value in my test app...

  sxpath = "/html/frameset/frame[2]/attribute::src"
    # s contains HTML not XML text
  d = libxml2dom.parseString(s, html=1)

  #get the tr list
  tr1 = d.xpath(sxpath)

  url = tr1[0]

  #get the url/link >>semester page
  #link = br.find_link(nr=1)

  #url = link.url
  print "link = ",url
  sys.exit()

err output
link =  <libxml2dom.Attribute object at 0xb7b7680c>

--------------------------------------

i'm not sure what i need to add to the line
  url = tr1
to resolve the issue/error...

looking over google hasn't given any real pointers...


thanks

-bruce





More information about the Python-list mailing list