Skip to content

Instantly share code, notes, and snippets.

@jschoch
Created June 29, 2013 15:08
Show Gist options
  • Save jschoch/5891462 to your computer and use it in GitHub Desktop.
Save jschoch/5891462 to your computer and use it in GitHub Desktop.
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
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