File: feedreader-test.vala

package info (click to toggle)
gxml 0.20.4%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,364 kB
  • sloc: xml: 131,277; ansic: 786; javascript: 328; python: 88; makefile: 35; sh: 11
file content (32 lines) | stat: -rw-r--r-- 1,065 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Copyright (C) 2017 Daniel Espinosa <esodan@gmail.com>
 * This is a GPL software
 *
 * To compile use:
 * valac --pkg gxml-0.14 --pkg gio-2.0 -o ./feedreader feedreader-test.vala
 *
 * To run:
 * ./feedreader
 */

using GXml;

public class FeedReader : GLib.Object {

  public static int main (string[] args) {
    try {
      var f = GLib.File.new_for_uri ("http://www.omgubuntu.co.uk/2017/05/kde-neon-5-10-available-download-comes-plasma-5-10");
      var ostream = new MemoryOutputStream.resizable ();
      ostream.splice (f.read (), GLib.OutputStreamSpliceFlags.CLOSE_SOURCE);
      //message ("Checkout source file:\n=================\n"+(string) ostream.data+"\n=================\n");
      var d = new XHtmlDocument.from_uri ("http://www.omgubuntu.co.uk/2017/05/kde-neon-5-10-available-download-comes-plasma-5-10");
      message (d.to_string ()+"\n=================\n");
      message (d.document_element.node_name+"\n=================\n");
    } catch (GLib.Error e) {
      warning ("Error: "+e.message);
      return 1;
    }
    return 0;
  }

}