Created
June 29, 2013 15:08
-
-
Save jschoch/5891462 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HtmlParsing.Mixfile do | |
use Mix.Project | |
def project do | |
[ app: :html_parsing, | |
version: "0.0.1", | |
deps: deps ] | |
end | |
# Configuration for the OTP application | |
def application do | |
[] | |
end | |
# Returns the list of dependencies in the format: | |
# { :foobar, "0.1", git: "https://github.com/elixir-lang/foobar.git" } | |
defp deps do | |
[ { :mochiweb, "2.7.0", github: "mochi/mochiweb" }, | |
{ :mochiweb_xpath, "1.2.0", github: "retnuh/mochiweb_xpath"}] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tst123 do | |
def run do | |
html = """ | |
<html> | |
<head> | |
<meta name="msvalidate.01" content="571BEF275C3851394BC3B74BFCFA861C" /> | |
<title>stink.net</title> | |
</head> | |
<body> | |
Check out <a href=http://google.com>google</a>! | |
<center> | |
<img height=40% src=R0012263.JPG> | |
</center> | |
</body> | |
</html> | |
""" | |
parsed = :mochiweb_html.parse(html) | |
found = :mochiweb_xpath.execute("/html/body//a/@href",html) | |
IO.puts(found) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment