File: document_save_to_stream.c

package info (click to toggle)
gxml 0.20.4%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,364 kB
  • sloc: xml: 131,277; ansic: 786; javascript: 328; python: 88; makefile: 35; sh: 11
file content (20 lines) | stat: -rw-r--r-- 576 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <gxml/gxml.h>
#include <stdio.h>

int main () {
  GXmlDocument *doc;
  GFile *outfile;
  GFileOutputStream *outstream;
  GCancellable *can = g_cancellable_new ();

  doc = gxml_document_new_from_path ("bookshelf.xml");

  outfile = g_file_new_for_path ("output/bookshelf_save_to_stream.xml");
  outstream = g_file_replace (outfile, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, can, NULL);
  gxml_document_save_to_stream (doc, G_OUTPUT_STREAM (outstream), can);

  g_object_unref (doc);
  // TODO: figure out how to close/unref outstream and outfile

  return 0;
}