File: document_properties.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 1,076 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;

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 ("Parsed: "+doc.write_string ());

print ("A document's node_name is: " + doc.node_name + " (which should always be '#document')\n");

// To be implemented
//print ("The document's doctype is: " + doc.doctype.node_name + " (which should be 'bookshelf')\n");

let impl = doc.implementation;
print ("GXml's implementation that created this document has the features\n  xml 1.0? " +
       (impl.has_feature ("xml", "1.0") ? "true" : "false") +
       " (should be true)\n  html? " +
       (impl.has_feature ("html", null) ? "true" : "false") +
       " (always true - FIXME)\n");

print ("Document has root element with name: " + doc.document_element.node_name + " (should be 'Bookshelf')");