xpath

XPath : Get nodes where child node contains an attribute

≡放荡痞女 提交于 2020-01-18 19:35:27
问题 Suppose I have the following XML: <book category="CLASSICS"> <title lang="it">Purgatorio</title> <author>Dante Alighieri</author> <year>1308</year> <price>30.00</price> </book> <book category="CLASSICS"> <title lang="it">Inferno</title> <author>Dante Alighieri</author> <year>1308</year> <price>30.00</price> </book> <book category="CHILDREN"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title lang="en"

【Hive】hive函数

≯℡__Kan透↙ 提交于 2020-01-18 09:39:17
文章目录 hive函数 hive内置函数 1. 查看内置函数 2. 测试内置函数快捷方式 3. 内置函数列表 3.1 关系运算: 3.2 数学运算: 3.3 逻辑运算: 3.4 复合类型构造函数 3.5 复合类型操作符 3.6 数值计算函数 3.7 集合操作函数 3.8 类型转换函数 3.9 日期函数 3.10 条件函数 3.11 字符串函数 3.12 混合函数 3.13 XPath 解析 XML 函数 3.14 汇总统计函数(UDAF) 3.15 表格生成函数 Table-Generating Functions (UDTF) hive自定义函数UDF 1. 自定义函数步骤 2. Json数据解析UDF开发 2.1 get_json_object 2.2 Transform 实现 hive函数 官方链接: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF hive内置函数 1. 查看内置函数 # 查看内置函数 show functions ; # 显示函数的详细信息: desc function abs ; # 显示函数的扩展信息: desc function extended concat ; 2. 测试内置函数快捷方式 直接使用 hive > select concat ( 'aa' ,

增量式

女生的网名这么多〃 提交于 2020-01-18 03:42:15
当我们在浏览相关网页的时候会发现,某些网站定时会在原有网页数据的基础上更新一批数据,例如某电影网站会实时更新一批最近热门的电影。小说网站会根据作者创作的进度实时更新最新的章节数据等等。那么,类似的情景,当我们在爬虫的过程中遇到时,我们是不是需要定时更新程序以便能爬取到网站中最近更新的数据呢? 1. 增量式爬虫 概念:通过爬虫程序监测某网站数据更新的情况,以便可以爬取到该网站更新出的新数据。 如何进行增量式的爬取工作: 在发送请求之前判断这个URL是不是之前爬取过 在解析内容后判断这部分内容是不是之前爬取过 写入存储介质时判断内容是不是已经在介质中存在 分析: 不难发现,其实增量爬取的核心是 去重 , 至于去重的操作在哪个步骤起作用,只能说各有利弊。在我看来,前两种思路需要根据实际情况取一个(也可能都用)。第一种思路适合不断有新页面出现的网站,比如说小说的新章节,每天的最新新闻等等;第二种思路则适合页面内容会更新的网站。第三个思路是相当于是最后的一道防线。这样做可以最大程度上达到去重的目的。 去重方法 将爬取过程中产生的url进行存储,存储在redis的set中。当下次进行数据爬取时,首先对即将要发起的请求对应的url在存储的url的set中做判断,如果存在则不进行请求,否则才进行请求。 对爬取到的网页内容进行唯一标识的制定,然后将该唯一表示存储至redis的set中

How do i make Xpath 1.0 query case insensitive

无人久伴 提交于 2020-01-17 11:15:47
问题 In PHP, I'm currently making a xpath query but I need to make it case insensitive. I'm using is XPath 1.0 which from my query means I've got to use some thing called a translate function but I'm unsure of how to do this. Here is my query test PHP file : $html = <<<'HTML' <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta NAME="Description" content="Test Case"> <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> <Link Rel="Canonical" href="http://www.testsite

Unable to fit the two expressions into my script

爱⌒轻易说出口 提交于 2020-01-17 08:04:33
问题 I've written a script to scrape documents from a web page using python in combination with selenium. However, the only thing I got stuck is print the value. As selenium doesn't support indexing in text, I can't think further to accomplish this. Taking a look into my code You will get to know what I meant. I've commented out the two lines to be rectified. Thanks in advance. Here is what I've written so far: from selenium import webdriver import time driver = webdriver.Chrome() driver.get(

Unable to fit the two expressions into my script

醉酒当歌 提交于 2020-01-17 08:04:09
问题 I've written a script to scrape documents from a web page using python in combination with selenium. However, the only thing I got stuck is print the value. As selenium doesn't support indexing in text, I can't think further to accomplish this. Taking a look into my code You will get to know what I meant. I've commented out the two lines to be rectified. Thanks in advance. Here is what I've written so far: from selenium import webdriver import time driver = webdriver.Chrome() driver.get(

Is it a xpath (lxml) bug?

我的未来我决定 提交于 2020-01-17 06:07:06
问题 I have my xpath: //*[namespace-uri() = 'http://foundation.org/UA/2011/03/NodeSet.xsd'][local-name() = 'Reference'][@ReferenceType = 'HasNotifier']/../../Description[@Locale="en"] but don't work with this xml file. Maybe is my mistake, or maybe is a lxml bug ... i don't know. I'm trying few day to create right and correct xpath code. But unfurnetli, i can't do this correct :( Is it a lxml bug or my mistake ? What I want to get, if "HasNotifier" print "002CC-ESSO01.(WAAA05.01?1)" My XML File

Pro-Football-Reference Team Stats XPath

血红的双手。 提交于 2020-01-17 05:20:10
问题 I am using the scrapy shell on this page Pittsburgh Steelers at New England Patriots - September 10th, 2015 to pull individual team stats. For example, I want to pull total yards for the away team (464) which, when inspecting the element and copying the XPath yields //*[@id="team_stats"]/tbody/tr[5]/td[1] but when I run response.xpath('//*[@id="team_stats"]/tbody/tr[5]/td[1]') nothing is returned. I noticed that this table is in a separate div from the initial data so I'm not sure if I need

xslt xpath using element values in xpath query

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-17 04:57:05
问题 Is it possible to use the element values in xpath? I have the following xml: <root> <html> <table class=" table search-results-property-table"> .... <tr> <td> <span class="versal">HAS TAXONOMIC LEVEL</span> </td> <td> <ul> <li> <a class="versal" href="../../../agrovoc/en/page/c_11125">genus</a> </li> </ul> </td> </tr> <tr> <td> <span class="versal">IS USED AS</span> </td> <td> <ul> <li> <a class="versal" href="../../../agrovoc/en/page/c_1591">christmas trees</a> </li> <li> <a class="versal"

R and xpathApply — removing duplicates from nested html tags

和自甴很熟 提交于 2020-01-17 04:55:14
问题 I have edited the question for brevity and clarity My goal is to find and XPath expression that will result in "test1"..."test8" listed separately. I am working with xpathApply to extract text from web pages. Due to the layout of various different pages that information will be pulled from, I need to extract the XML values from all <font> and <p> html tags. The problem I run into is when one type is nested within the other, resulting in partial duplicates when I use the following xpathApply