From the following, I'd like to grab the text.
<li><span class="literal"><span property="dbpedia-owl:abstract" xmlns:dbpedia-owl="http://ift.tt/1bYoPS2" xml:lang="en">text</span></span></li>
Currently I'm using:
ns = {"xmlns" => "http://ift.tt/lH0Osb"}
ns = {"xml" => "http://ift.tt/1ikcaie"}`
array << doc.xpath("//span[@property='dbpedia-owl:abstract' and xmlns:dbpedia-owl='http://ift.tt/1bYoPS2' and @xml:lang='en']").text`
I'm not sure if it's my xpath array or namespace declaration that is wrong, but either way I'm not doing something right. Apologies if the question has been asked previously, but I couldn't find something combining namespaces and multiple attributes, so I might just be combining solutions that I found to those separate problems improperly. It might also be an issue with the xmlsn:dbpedia-owl value being a URL, but again, not sure.
Thanks.
No comments:
Post a Comment