File: document_new_from_string.js

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 (21 lines) | stat: -rwxr-xr-x 593 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/gjs

const GXml = imports.gi.GXml;
const Gio = imports.gi.Gio;

function create_a_document_from_a_string () {
    let xml = "<?xml version=\"1.0\"?>\
<Bookshelf>\
<Owner fullname=\"John Green\"/>\
<Books>\
<Book author=\"John Green\" title=\"The Fault in Our Stars\"/>\
<Book author=\"Jane Austen\" title=\"Pride &amp; Prejudice\"/>\
<Book author=\"J.D. Salinger\" title=\"Nine Stories\"/>\
</Books>\
</Bookshelf>";
    let doc = GXml.GomDocument.from_string (xml);
    print ("create_a_document_from_a_string:\n" + doc.write_string ());
    
}

create_a_document_from_a_string ();