[lxml-dev] xpath problem
I'm having a problem with xpath and here are the details: Xml fragment: <head> <docdata> <identified-content> <classifier class="indexing_service" type="descriptor">Ships and Shipping</classifier> Xpath: '/nitf/head/docdata/identifiedcontent/classifier[@class="indexing_service" and @type="descriptor"]' Code: descriptors_list = tree.xpath('/nitf/head/docdata/identifiedcontent/classifier[@class="indexing_service" and @type="descriptor"]') for descriptors_element in descriptors_list: print descriptors_element.tag, descriptors_element.text for child in descriptors_element.getchildren(): print child.tag, child.text But, the code isn't picking up the required text eg. 'Ships and Shipping'. Any ideas what is incorrect? Dinesh
participants (1)
-
Dinesh B Vadhia