xpath

Evaluate XPath 2.0 in PHP

☆樱花仙子☆ 提交于 2021-01-28 04:45:59
问题 I am currently working on a project written in PHP and want to evaluate XPath expression on XML files. Since the files are a quite complex, my XPath contains expressions like for...in...return -loops or other features introduced with XPath 2. Unfortunately PHP's DOMXPath class supports only XPath 1.0, and I didn't find any XPath 2.0 evaluator for PHP. Has anybody faced the same problem and found a solution? 回答1: Saxon/C (currently in beta) can be called from PHP. It's open source, covered

Calling a function in XSLT

假如想象 提交于 2021-01-28 04:42:26
问题 I try to run one of the functions which are linked bellow in my own stylesheet. But I dont know how. Here is an xsltransform.net demo . And here are the functions I want to run: func 1 func 2 回答1: Assuming an XSLT 2.0 processor like Saxon 9 you can use xsl:function as follows: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:func="http://example.com/mf"> <xsl:output method="html" indent="yes"/> <xsl:strip-space

Regex in lxml for python

旧时模样 提交于 2021-01-28 04:10:08
问题 I having trouble implementing regex within xpath command. My goal here is to download the html contents of the main page, as well as the contents of all hyperlinks on the main page. However, the program throws exceptions because some of the href links do not connect to anything (ex. '//:javascript', or '#'). How would I use regex in xpath? Is there an easier way to except non-absolute hrefs? from lxml import html import requests main_pg = requests.get("http://gazetaolekma.ru/") with open(

Enable XPath2 queries in System.Xml.XPath (XPathException: invalid token)

落花浮王杯 提交于 2021-01-28 03:56:09
问题 Microsofts System.Xml.XPath nuget-package, available for .NET 4.6, claims to support XPath 1.0 and 2.0. De documentation says descibes the namespace: The System.Xml.XPath namespace contains the classes that define a cursor model for navigating and editing XML information items as instances of the XQuery 1.0 and XPath 2.0 Data Model. After upgrading Visual Studio, upgrading and all my projects to framework version 4.6 I still can't get the simplest XPath-2.0 for-expression to work. According

How to write xpath with contains ID using TestCafé?

一个人想着一个人 提交于 2021-01-28 03:09:55
问题 Need to take the dynamic ID using "contains" keyword in TestCafé selector. html: <div id="content-body-14269002-17290547"> xpath: //div[contains(@id,"content-body")] I would like to write above xpath in TestCafé Selector Is it possible to do? 回答1: I believe this is not supported. See here. A good workaround I can recommend to handle such cases is to use xpath-to-css package. Also, you can just create a CSS selector for this case, CSS Selector for partial id match will be: div[id*='content

VBScript: XPath Query with multiple namespaces

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 02:35:19
问题 What XPath query should I use to get to the GetLogisticsOfferDateResult Node? I have attached the vbscript that I'm using. I suspect the problem has to do with the multiple namespaces in the document. But how do I reference the second namespace in the XPath? Dim responseXML responseXML = '"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/""><s:Body><GetLogisticsOfferDateResponse xmlns=""http://schneider-electric.com/OrderEntryService""><GetLogisticsOfferDateResult>2010-07-20<

Web scraping with selenium and python - xpath with contains text

こ雲淡風輕ζ 提交于 2021-01-28 02:00:22
问题 I will try to make it really short. I am trying to click on a product that came out of a search from a website. Basically there is a list of matching products, and I want to click on the first one which contains the product name I searched in its title. I will post the link of the website so you can inspect its DOM structure: https://www.tonercartuccestampanti.it/#/dfclassic/query=CE285A&query_name=match_and In this case, many contain my query string, and I would simply like to click on the

The required WSDL extension element 'binding' from namespace

坚强是说给别人听的谎言 提交于 2021-01-27 22:05:09
问题 I'm having an huge problem with the my web service. When I try to generate the files via svcutil I get the following error messages: Attempting to download metadata from 'http://srv:13208/GROUPING_WS_ASMX.as mx' using WS-Metadata Exchange or DISCO. Error: Cannot import wsdl:binding Detail: The required WSDL extension element 'binding' from namespace 'http://sch emas.xmlsoap.org/wsdl/http/' was not handled. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://grouping/']/wsdl

VBScript: XPath Query with multiple namespaces

馋奶兔 提交于 2021-01-27 21:29:09
问题 What XPath query should I use to get to the GetLogisticsOfferDateResult Node? I have attached the vbscript that I'm using. I suspect the problem has to do with the multiple namespaces in the document. But how do I reference the second namespace in the XPath? Dim responseXML responseXML = '"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/""><s:Body><GetLogisticsOfferDateResponse xmlns=""http://schneider-electric.com/OrderEntryService""><GetLogisticsOfferDateResult>2010-07-20<

unable to use sendKeys“sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)”

北城以北 提交于 2021-01-27 21:10:49
问题 I am trying to send "String" as argument in sendKeys method [type WebElement] but system is using it as char sequence, so I am not getting proper output. public static void setGridDropDownValue(Selenium selenium, WebDriver webDriver, String strGridId, int nRowIndex, int nCellIndex, String strValue) { String strXPath = "//div[@id='"+strGridId+"']//table/tbody/tr[2]/td/div/div/table/tbody/tr["+(nRowIndex+2)+"]/td["+(nCellIndex+1)+"]/"; selenium.click(strXPath); selenium.doubleClick(strXPath);