summary refs log tree commit diff stats
path: root/examples/htmltitle.nim
diff options
context:
space:
mode:
authorawr1 <41453959+awr1@users.noreply.github.com>2018-09-04 16:33:52 -0500
committerGitHub <noreply@github.com>2018-09-04 16:33:52 -0500
commiteb668003bf35671d7358e5f54e05820c0f4aef3d (patch)
treee5c5d6315f8ba4a5dd647bf67a4d0afb609916e7 /examples/htmltitle.nim
parent89ad1cc9b18db8320e5b170ee45888cf79d52001 (diff)
parent4aba2981dd47672744191bd17b39bb149f494637 (diff)
downloadNim-eb668003bf35671d7358e5f54e05820c0f4aef3d.tar.gz
Merge branch 'devel' into experimentalize-reorder
Diffstat (limited to 'examples/htmltitle.nim')
-rw-r--r--examples/htmltitle.nim36
1 files changed, 0 insertions, 36 deletions
diff --git a/examples/htmltitle.nim b/examples/htmltitle.nim
deleted file mode 100644
index 96bfc7d91..000000000
--- a/examples/htmltitle.nim
+++ /dev/null
@@ -1,36 +0,0 @@
-# Example program to show the parsexml module
-# This program reads an HTML file and writes its title to stdout.
-# Errors and whitespace are ignored.
-
-import os, streams, parsexml, strutils
-
-if paramCount() < 1:
-  quit("Usage: htmltitle filename[.html]")
-
-var filename = addFileExt(paramStr(1), "html")
-var s = newFileStream(filename, fmRead)
-if s == nil: quit("cannot open the file " & filename)
-var x: XmlParser
-open(x, s, filename)
-while true:
-  x.next()
-  case x.kind
-  of xmlElementStart:
-    if cmpIgnoreCase(x.elementName, "title") == 0:
-      var title = ""
-      x.next()  # skip "<title>"
-      while x.kind == xmlCharData:
-        title.add(x.charData)
-        x.next()
-      if x.kind == xmlElementEnd and cmpIgnoreCase(x.elementName, "title") == 0:
-        echo("Title: " & title)
-        quit(0) # Success!
-      else:
-        echo(x.errorMsgExpected("/title"))
-
-  of xmlEof: break # end of file reached
-  else: discard # ignore other events
-
-x.close()
-quit("Could not determine title!")
-