xpath

What is the valid XPATH to validate the node

霸气de小男生 提交于 2020-01-25 19:59:32
问题 Here is the xml <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:processRequestResponse xmlns:ns="http://service.soap.oneflexi.com"><ns:return> <?xml version="1.0" encoding="UTF-8"?> <ItemRs language="SG" currency="SGD"> <Items> <Item> <CategoryCode /> <CategoryDescription /> <ItemCode>356</ItemCode> <ItemDescription>20% offer, Latest model</ItemDescription> <Quantity /> <UnitPrice>24560</UnitPrice>

JavaCC - parse a step of an XPATH expression

三世轮回 提交于 2020-01-25 12:52:26
问题 I'm trying to write a JavaCC script for a (simple) XPath parser and I'm having problems with the part to parse individual steps. My idea of the grammar is this: Step ::= ( AxisName "::" )? NodeTest ( "[" Predicate "]" )* I have transformed it into the following script snippet: Step Step() : { Token t; Step step; Axis axis; NodeTest nodeTest; Expression predicate; } { { axis = Axis.child; } ( t = <IDENTIFIER> { axis = Axis.valueOf(t.image); } <COLON> <COLON> )? t = <IDENTIFIER> { nodeTest =

Convert JSON to XML using XSLT 3.0 - escape ampersand in element key

旧时模样 提交于 2020-01-25 10:49:08
问题 Usign XSLT we wish to transform the JSON to XML : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:math="http://www.w3.org/2005/xpath-functions/math" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs math" version="3.0"> <xsl:output indent="yes" /> <xsl:template match="data"> <xsl:copy-of select="json-to-xml(.)" /> </xsl:template> </xsl:stylesheet> We have follwing JSON output from Microsoft Dynamics 365 that

爬虫学习——批量在geoserver发布矢量数据

左心房为你撑大大i 提交于 2020-01-25 10:08:17
前提:数据样式格式一致 工具:selenium+Chromedriver; 本次代码主要依靠selenium+Python,浏览器我用的是Chrome浏览器以及相应的驱动Chromedriver,selenium可以通过pip安装,Chromedriver要去网上下载与浏览器版本一致的安装包,具体安装过程自行百度。 数据前期准备: Python代码: import time from selenium import webdriver import os def getFiles(dir, suffix): # 查找根目录,文件后缀 res = [] for root, directory, files in os.walk(dir): # =>当前根,根下目录,目录下的文件 for filename in files: name, suf = os.path.splitext(filename) # =>文件名,文件后缀 if suf == suffix: res.append(name) # =>吧一串字符串组合成路径 return res driver= webdriver.Chrome() driver.get('http://localhost:8080/geoserver/web/wicket/bookmarkable/org.geoserver.web.data

Multiple NameSpace in Xml Xpath value

折月煮酒 提交于 2020-01-25 08:25:07
问题 Am new in using Xpath parsing in Java for Xmls. But I learnt it and it worked pretty well until this below issue am not sure how to go traverse to next node in this . Please find the below code and Let me know what needs to be corrected . package test; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.TransformerException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath

How change the XPATH and XML output format in DataStage?

混江龙づ霸主 提交于 2020-01-25 08:04:33
问题 I HAVE some problem in XPATH In XML Output I Want The Output Like <categories> <category NAME="A"> <redcord a="1"></redcord> <redcord a="2"></redcord> </category> <category NAME="B"> <redcord b="ASD"></redcord> <redcord b="QWE"></redcord> </category> </categories> I HAVE XPATH LIKE : /categories/category[@NAME="A"]/redcord/@a AND /categories/category[@NAME="B"]/redcord/@b The Output that i've been making is <categories> <category NAME="A"> <redcord a="1" b="ASD"></redcord> <redcord a="2" b=

Why importxml and importhtml not working here?

こ雲淡風輕ζ 提交于 2020-01-25 07:04:47
问题 =Importhtml("https://app.neilpatel.com/en/ubersuggest/keyword_ideas?keyword=Food%20Chart&locId=2840&lang=en", "table", 3) =ImportXML("https://app.neilpatel.com/en/ubersuggest/keyword_ideas?keyword=Food%20Chart&locId=2840&lang=en","//div[@class='css-19jz7zx']") I use the above formula to get keywords in my google sheet. but I only get #N/A (Error Imported content is empty) I'm unable to understand what is wrong with my formula, why I'm unable to get data. please help me with this. 回答1: I think

Clicking on Javascript tab using Selenium and Python without unique class id or element name

删除回忆录丶 提交于 2020-01-25 06:17:48
问题 I have this HTML element code which I am currently struggling to figure out to use it for clicking on the tab that says Problem. As the "Problem" doesnt have a unique classname or element ID, I am unable to figure how to send a Click(). I have tried to check if z-index can be used as index(assumed) and used below line of code browser.switch_to_frame(a[3]) but it seems I am wrong. HTML code as below <div class="TabsViewPort" style="position: relative; overflow: hidden; width: 896px; height:

Clicking on Javascript tab using Selenium and Python without unique class id or element name

你离开我真会死。 提交于 2020-01-25 06:17:44
问题 I have this HTML element code which I am currently struggling to figure out to use it for clicking on the tab that says Problem. As the "Problem" doesnt have a unique classname or element ID, I am unable to figure how to send a Click(). I have tried to check if z-index can be used as index(assumed) and used below line of code browser.switch_to_frame(a[3]) but it seems I am wrong. HTML code as below <div class="TabsViewPort" style="position: relative; overflow: hidden; width: 896px; height:

Scrapy基础(十三)————ItemLoader的简单使用

陌路散爱 提交于 2020-01-25 03:46:42
ItemLoader的简单使用:目的是解决在爬虫文件中代码结构杂乱,无序,可读性差的缺点 经过之前的基础,我们可以爬取一些不用登录,没有Ajax的,等等其他的简单的爬虫 回顾我们的代码,是不是有点冗长,将所需字段通过xpath或者css解析出来,再自定义语句(还不是函数中) 进行清洗;然后再装入Item中,有没有这样一种方法:从Item中可以直接清洗岂不是很简单 今天就学习 ItemLoader这样一种对戏,简单代码,可读增强 思路: 1,创建一个ItemLoad对象 2,通过该对象的add_css或者add_xpath或者add_value方法将解析语句装入ItemLoader 3,在Item.py中在Filder()中调用函数,用来清洗,处理数据 4,artical_item = item_loader.load_item() 调用这个对象的此方法,写入到Item中 具体代码: 在爬虫文件中: 1 #先引入 2 from ArticalSpider.items import JobboleArticalItem,ArticalItemLoader 3 #使用Itemloader来简化这个解析,装入Item这个过程,使得代码量减少 4 #先创建一个itemLoader()这样一个对象,不需解析list第一个等问题 5