newbee and xpath

Okay, I'm brand new to this, so please help me out here.

 

What I'm trying to do, is to get the file path of all sections defined within PMS

 

 

sections = XML.ElementFromURL(":32400/library/sections/.xpath('//Directory')    
        for section in sections:

title = section.get('title')

 

 

And I got titles of the sections, but....

 

How do I get the path of each section?

 

Best Regards

 

Tommy

There could be more than one path for a given section. But you want something along the lines of:

for section in sections:
    title = section.get('title')
    paths = section.xpath('Location/@path')
    print "%s - %s" % (title, ', '.join(paths))

There could be more than one path for a given section. But you want something along the lines of:

for section in sections:
    title = section.get('title')
    paths = section.xpath('Location/@path')
    print "%s - %s" % (title, ', '.join(paths))

Sir...You have just saved my marriage, cuz. I was close to go crazy here.....

I'll take this suggestion out for a spin, but regardless, huge thanx for responding here.....

You got one + point in my white book for this, so feel free to cash in @ any time

Best regards

Tommy

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.