[gxml/gsoc2013: 76/150] Document.vala: add root element for Document.with_implementation



commit 6990adfb0297231c42725b3ee04c46ba80c5628c
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 27 00:01:53 2013 -0400

    Document.vala: add root element for Document.with_implementation

 gxml/Document.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index 7f61e31..d75ab0d 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -260,6 +260,11 @@ namespace GXml {
                internal Document.with_implementation (Implementation impl, string? namespace_uri, string? 
qualified_name, DocumentType? doctype) {
                        this ();
                        this.implementation = impl;
+
+                       DomNode root;
+                       root = this.create_element (qualified_name); // TODO: we do not currently support 
namespaces, but when we do, this new node will want one
+                       this.append_child (root);
+
                        this.namespace_uri = namespace_uri;
                        /* TODO: find out what should be set to qualified_name; perhaps this.node_name, but 
then that's supposed
                           to be "#document" according to NodeType definitions in 
http://www.w3.org/TR/DOM-Level-3-Core/core.html */
@@ -302,8 +307,9 @@ namespace GXml {
                 * Creates a Document from the file at file_path.
                 */
                public Document.from_path (string file_path) {
-                       Xml.Doc *doc = Xml.Parser.parse_file (file_path); // consider using read_file
                        // TODO: might want to check that the file_path exists
+                       // consider using Xml.Parser.read_file
+                       Xml.Doc *doc = Xml.Parser.parse_file (file_path);
                        this.from_libxml2 (doc);
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]