[gxml/gsoc2013: 16/69] Implementation.vala, Document.vala: support creation of documents from Implementation
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml/gsoc2013: 16/69] Implementation.vala, Document.vala: support creation of documents from Implementation
- Date: Sat, 27 Jul 2013 04:07:33 +0000 (UTC)
commit 9c73918f34327248c82126af660904be84f5ea71
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Implementation.vala, Document.vala: support creation of documents from Implementation
gxml/Document.vala | 25 ++++++++++++++++++++++++-
gxml/Implementation.vala | 14 ++++++++++++++
2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index bbc302f..ec14912 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -231,7 +231,30 @@ namespace GXml {
this.xmldoc->free ();
}
- /** Constructor */
+ /** Constructors */
+
+ /**
+ * Creates a Document from a given Implementation, supporting
+ * the {@ GXml.Implementation.create_document} method. It is
+ * defined here:
+ * http://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument
+ *
+ * @param impl Implementation creating this Document.
+ * @param namespace_uri URI for the namespace in which this Document belongs, or `null`.
+ * @param qualified_name A qualified name for the Document, or `null`.
+ * @param doctype The type of the document, or `null`.
+ *
+ * @return The new document.
+ */
+ internal Document.with_implementation (Implementation impl, string? namespace_uri, string?
qualified_name, DocumentType? doctype) {
+ this ();
+ this.implementation = impl;
+ 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 */
+ this.doctype = doctype;
+ }
+
/**
* Creates a Document based on a libxml2 Xml.Doc* object.
*/
diff --git a/gxml/Implementation.vala b/gxml/Implementation.vala
index 60efb55..d0dfb56 100644
--- a/gxml/Implementation.vala
+++ b/gxml/Implementation.vala
@@ -38,6 +38,20 @@ namespace GXml {
}
/**
+ * Creates a Document according to this { link GXml.Implementation}.
+ *
+ * @param namespace_uri URI for the namespace in which this Document belongs, or `null`.
+ * @param qualified_name A qualified name for the Document, or `null`.
+ * @param doctype The type of the document, or `null`.
+ *
+ * @return The new document.
+ */
+ public Document create_document (string? namespace_uri, string? qualified_name, DocumentType?
doctype) {
+ Document doc = new Document.with_implementation (this, namespace_uri, qualified_name,
doctype);
+ return doc;
+ }
+
+ /**
* Reports whether we support a feature at a given version level.
*
* @param feature A feature we might support, usually something like 'xml' or 'html'.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]