Values that are not inside XML being imported improperly - google-sheets

I'm trying to import links that are inside a map that I'm specifying in detail in the formula:
=IMPORTXML(
"http://sports.williamhill.com/bet/pt/betlive/9",
"//tr[#class='rowLive']//td[#scope='col']//a/#href"
)
The links I'm looking for are at this location on the page:
The expected result would be this:
But for some reason I can't understand, the result is being this:
I would like help to understand what is going on and how I should map the XML correctly so that these values no longer appear.

try:
=UNIQUE(FILTER(IMPORTXML("http://sports.williamhill.com/bet/pt/betlive/9",
"//tr[#class='rowLive']//td[#scope='col']//a/#href"),
ISURL(IMPORTXML("http://sports.williamhill.com/bet/pt/betlive/9",
"//tr[#class='rowLive']//td[#scope='col']//a/#href"))))

Related

Error: 'Imported XML Content cannot be parsed'

Here's what I'm doing:
=IMPORTXML("https://www.predictit.org/api/marketdata/markets/7164", "/MarketData/Contracts/MarketContract/ID")
The other answers I've seen about this have said that Javascript would be the issue, but the page in question seems to load without it, and I've tried using IMPORTJSON and IMPORTFROMWEB to no avail.
Please help!
You are input incorrect parameter for the xmlpath, a proper formula should be as following and you need to spend sometime to find the correct xmlpath to extract the specific string or information you want,
=IMPORTXML("https://www.predictit.org/api/marketdata/markets/7164","//a/#href")
Here is one example from Google:
=IMPORTXML("https://en.wikipedia.org/wiki/Moon_landing", "//a/#href")

Attempting to import from a XPath, seems to always yield blank information

Currently in my google doc, i'm working on a database for my card worth, and it seems like it doesn't want to grab the information no matter what xpath i want to attempt.
Website i'm trying to take information available here. *This is the hyperlink i'm feeding
In the top right corner i'm attempting to grab the worth box information, here is current xpaths i've attempted
"//a[#id='worthBox']/h4"
"/html/body/div[4]/div[1]/div[2]/form/div[1]/div[2]/div/a/h4"
"/h4"
"/h4[0-20]"
"//a[#id='worthBox'][1]/h4"
"//div[#id='estimate-box']/a/h4"
"//div[#id='estimate-box']/a[1]/h4"
Can someone explain to me why it doesn't seem to wanna fetch, is it even possible?
Thank you so much for your time and help!
In the URL, the value is put using the Javascript. But IMPORTXML cannot retrieve the result after Javascript was run. IMPORTXML retrieves the HTML without running Javascript. I think that your xpath is the result after Javascript was run. By this, they cannot be used. But it seems that the value you expect can be retrieved other xpath.
Modified xpath:
//input[#id='medianHiddenField']/#value
Sample formula:
=IMPORTXML(A1,"//input[#id='medianHiddenField']/#value")
In this case, the URL of https://mavin.io/search?q=Lugia%20NM%209%2F111%20-PSA&bt=sold# put in the cell "A1".
Result:
Reference:
IMPORTXML

Why using List<T> as stack returns _GrowableList

I am new to Flutter and Dart. I have implemented list as stack reference for code here. I am calculating path from one node to other in graph. Problem with code is it returns _GrowableList on which is either empty or null but my GetAnswer do returns a correct list(checked while debugging). Why it automatically converts it into growable, How can I have my normal list?
Here is snippet of code where I am passing my graph start node and end node to instance of GetAnswer and storing back result in path variable.
That's the real internal type for the list you created. However, it shouldn't really look like this in the tooltip, this is how it looks for me:
If you can provide code that reproduces showing the tooltip like that, I'd love to take a look. Please open a bug in GitHub.
(It's possible you're on v2.11 of Dart Code - if so, please update to v2.12 and this should be improved)

Incrementing offset of Location and clicking on location

I got a problem on clicking locations. The thing I do is creating a AST from a method with the function:
getMethodASTEclipse(method, model=projectModel);
where method is just an instance of
methods(projectModel);
When I visit that tree and want to get if statements for example I can call
case i: \if(_, _, _):println(i#src);
The source will be printed and I can click on it, eclipse will go to the right class with the right if statement. The form is like this:
|project://MyProject/src/MyClass.java|(2836,143,<104,1>,<109,2>)
But when I get the AST from file with the method:
createAstFromFile(class, true);
and giving a class instaed of a method or even a file I can also visit it and get the same if statement and print it but the form of it is different and I can't click on it. Why not ?
The form of it looks like this:
|java+class:///MyClass/src/MyClass|(17938,1105,<544,4>,<570,5>)
What I also notice is that the offsets are incrementing heavily after each location is printed.
How can I make it clickable to the right location? I think it has to do something with the offset and the form of the location. I tried to use the method:
resolveJava(loc l);
from the Registry class but that didn't work either and tried to look up at declarations for the |loc definition but that wasn't there either.
Thanks in advance.
The reason the locations aren't clickable is because they cannot be resolved. The problem is that createAstFromFile(_,_) was only intended to be used with locations that have either project or file schemes.
For now, you can get the physical location from the declarations annotation in the model and use that to create the AST.
We'll look into making it so that it is possible to use locations with other schemes as well.

Hpricot CSS Class search

I am working on some code that scrapes a page for two css classes on a page. I am simply using the Hpricot search method for this as so:
webpage.search("body").search("div.first_class | div.second_class")
...for each item found i create an object and put it into an array, this works great except for one thing.
The search will go through the entire html page and add an object into an array every time it comes across '.first_class' and then it will go through the document again looking for '.second_class', resulting in the final array containing all of the searched items in the incorrect order in the array, i.e all of the '.first_class' objects, followed by all the '.second_class' objects.
Is there a way i can get this to search the document in one go and add an object into the array each time it comes across one of the specified classes, giving me an array of items that is in the order they are come across in on the page i am scraping?
Any help much appreciated. Thanks
See the section here on "Checking for a Few Attributes":
http://wiki.github.com/why/hpricot/hpricot-challenge
You should be able to stack the elements in the same way as you do attributes. This feature is apparently possible in Hpricot versions after 2006 Mar 17... An example with elements is:
doc.search("[#href][#type]")
Ok so it turned out i was mistaken and this didn't do anything different to what i previously had at all. However, i have come up with a solution, wether it is the most suitable or not i am not sure. It seems like a fairly straight forward for an annoying problem though.
I now perform the search for the two classes above as i mentioned above:
webpage.search("body").search("[#class~='first_class']|[#class~='second_class']")
However this still returned an array firstly containing all the divs with a class of 'first_class' followed by all divs with a class of 'second_class'. So to fix this and get an array of all the items as they appear in order on the page, i simply chain the 'add_class' method with my own custom class e.g. 'foo_bar'. This then allows me to perform another search on the page for all divs with just this one tag, thus returning an array of all the items i am after, in the order they appear on the page.
webpage.search("body").search("[#class~='first_class']|[#class~='second_class']").add_class("foo_bar")
webpage.search("body").search("[#class~='foo_bar']")
Thanks for the tip. I hadn't spotted that in the documentation and also found another page i hadnt seen either. I have fixed this with the following line:
webpage.search("body").search("[#class~='first_class']|[#class~='second_class']")
This now adds an object into the array each time it comes across one of the above classes in the document. Brilliant!

Resources