Getting anchor text from a webpage using xpath within YQL - yql

SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()"
does not work, whereas
SELECT * FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a/text()"
does.
SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a"
also works, it seems YQL has a bug, or am I missing something?

Is this what you are looking for?
SELECT content FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//a"

SELECT href
FROM html
WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state"
AND xpath="//a"
Try it on the YQL console.

Related

How can I select all anchor tag whose href starting with tel: ie href="tel:12334......"

some text
some text 1-800-223-7440 or for all other inquiries please feel free to
1-800-413-8840
How can I select all anchor tag whose href starting with tel: ie href="tel:+123-34......"
You want to select them by using what?
If you are using jQuery - you can write something like this: jQuery('a[href^="tel"]')

Use of html in textarea not working correct

My cms is actievadmin and just installed tinymce for editing in the textarea. When i make changes (bold, paragraph tags ect) the page showing raw html. In the DB is stored with the html but is not rendering the html.
Does anyone know what this problem is?
Try replacing the output on your page to something like this:
<%=raw #model.content %>

How do I get jQuery autocomplete to show anchor tags?

How do I get jQuery autocomplete to show <a> tags?
I'm using jQuery autocommit to search names. I would like the dropdown returned from the Server to include HTML, specifically <a> tags, so I can return the name and the email and the company each within an <a> tag.
Currently, the HTML that I return from the server is displayed in the autcommit dropdown as text and doesn't act as HTML?
Take a look at this, and see if it helps: http://forum.jquery.com/topic/using-html-in-autocomplete

Beginner question about using YQL to get html webpage in json

I am trying to scrape a webpage using yql. I thought outputing it as json would give me all the content as one object. However if there are any html tags like < strong > that text is not included in "content". Is there any way around this or should I just get it as xml and regex out the tags?
It should return all elements from the page if your YQL statement is select * from html where url="http://www.cnn.com".
select * from html where url="http://www.cnn.com".

mvc formatting text

i have text like this
div bla-bla end div
i need to get only 'bla-bla' without div, because of i need to call substring in controller only to text bla-bla not to div tags. is it possible
p.s. how to input tags here?
If you have jquery you can access inner html by calling ( for example ):
$("#idofthediv").html()
to set the conntent of the div:
$("#idofthediv").html('some html')
document.findElementById(..).innerText;
Take a look at using a Regular Expression.
There is a sample of what you want to do at Regular Expression Examples. It's the first sample in the section titled "Grabbing HTML Tags" near the top of the page.

Resources