[gxml] GomDocument: renamed to Document
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomDocument: renamed to Document
- Date: Fri, 5 Jul 2019 20:23:14 +0000 (UTC)
commit 54456d43339bfb43f99bda8491033a3fb7dd3160
Author: Daniel Espinosa <esodan gmail com>
Date: Fri Jul 5 14:46:47 2019 -0500
GomDocument: renamed to Document
examples/c/document_new.c | 2 +-
examples/vala/example.vala | 20 ++---
gxml/{GomDocument.vala => Document.vala} | 34 ++++----
gxml/GomElement.vala | 24 +++---
gxml/Node.vala | 2 +-
gxml/XParser.vala | 4 +-
gxml/meson.build | 2 +-
test/CssSelectorTest.vala | 38 ++++-----
test/{GomDocumentTest.vala => DocumentTest.vala} | 100 +++++++++++------------
test/GXmlTest.vala | 2 +-
test/GomDocumentPerformanceTest.vala | 2 +-
test/GomElementTest.vala | 22 ++---
test/meson.build | 2 +-
13 files changed, 127 insertions(+), 127 deletions(-)
---
diff --git a/examples/c/document_new.c b/examples/c/document_new.c
index bd43994..9f01326 100644
--- a/examples/c/document_new.c
+++ b/examples/c/document_new.c
@@ -14,7 +14,7 @@ int main () {
char *authors[] = { "John Green", "Jane Austen", "J.D. Salinger" };
char *titles[] = { "The Fault in Our Stars", "Pride & Prejudice", "Nine Stories" };
- doc = (GXmlDomDocument*) gxml_gom_document_new ();
+ doc = (GXmlDomDocument*) gxml_document_new ();
// Add a root node
root = gxml_dom_document_create_element (doc, "Bookshelf", &error);
diff --git a/examples/vala/example.vala b/examples/vala/example.vala
index 1e45cbf..a688f44 100755
--- a/examples/vala/example.vala
+++ b/examples/vala/example.vala
@@ -4,7 +4,7 @@ void create_a_document () throws GLib.Error {
string[] authors = { "John Green", "Jane Austen", "J.D. Salinger" };
string[] titles = { "The Fault in Our Stars", "Pride & Prejudice", "Nine Stories" };
- DomDocument doc = new GomDocument ();
+ DomDocument doc = new GXml.Document ();
DomElement root = doc.create_element ("Bookshelf");
doc.append_child (root);
DomElement owner = doc.create_element ("Owner");
@@ -21,7 +21,7 @@ void create_a_document () throws GLib.Error {
books.append_child (book);
}
- stdout.printf ("create_a_document:\n%s\n", (doc as GomDocument).write_string ());
+ stdout.printf ("create_a_document:\n%s\n", (doc as GXml.Document).write_string ());
}
void create_a_document_from_a_string () throws GLib.Error {
@@ -38,8 +38,8 @@ void create_a_document_from_a_string () throws GLib.Error {
</Books>
</Bookshelf>""";
- doc = new GomDocument.from_string (xml);
- stdout.printf ("create_a_document_from_a_string:\n%s\n", (doc as GomDocument).write_string ());
+ doc = new GXml.Document.from_string (xml);
+ stdout.printf ("create_a_document_from_a_string:\n%s\n", (doc as GXml.Document).write_string ());
}
void create_a_document_from_a_file (string uri) throws GLib.Error {
@@ -47,16 +47,16 @@ void create_a_document_from_a_file (string uri) throws GLib.Error {
stdout.printf (uri+"\n");
DomDocument doc;
- doc = new GomDocument.from_file (f);
- stdout.printf ("create_a_document_from_a_file:\n%s\n", (doc as GomDocument).write_string ());
+ doc = new GXml.Document.from_file (f);
+ stdout.printf ("create_a_document_from_a_file:\n%s\n", (doc as GXml.Document).write_string ());
}
void create_a_document_from_a_path (string uri) throws GLib.Error {
DomDocument doc;
GLib.File f = GLib.File.new_for_uri (uri+"/bookshelf2.xml");
- doc = new GomDocument.from_path (f.get_path ());
- stdout.printf ("create_a_document_from_a_path:\n%s\n", (doc as GomDocument).write_string ());
+ doc = new GXml.Document.from_path (f.get_path ());
+ stdout.printf ("create_a_document_from_a_path:\n%s\n", (doc as GXml.Document).write_string ());
}
void saving_a_document_to_a_path (string uri) throws GLib.Error {
@@ -74,9 +74,9 @@ void saving_a_document_to_a_path (string uri) throws GLib.Error {
</Bookshelf>""";
GLib.File f = GLib.File.new_for_uri (uri+"/bookshelf2.xml");
stdout.printf (f.get_path ()+"\n");
- doc = new GomDocument.from_string (xml);
+ doc = new GXml.Document.from_string (xml);
if (f.query_exists ()) f.delete ();
- (doc as GomDocument).write_file (f);
+ (doc as GXml.Document).write_file (f);
if (!f.query_exists ()) stdout.printf ("Can't save file bookshelf2.xml");
}
diff --git a/gxml/GomDocument.vala b/gxml/Document.vala
similarity index 93%
rename from gxml/GomDocument.vala
rename to gxml/Document.vala
index a74e1cf..a59c34a 100644
--- a/gxml/GomDocument.vala
+++ b/gxml/Document.vala
@@ -31,7 +31,7 @@ using GXml;
* If you define a property in a derived class with a nick's name '::ROOT' it
* will be initialized and used as root node to parse documents.
*/
-public class GXml.GomDocument : GXml.Node,
+public class GXml.Document : GXml.Node,
DomParentNode,
DomNonElementParentNode,
DomDocument,
@@ -79,8 +79,8 @@ public class GXml.GomDocument : GXml.Node,
_content_type = "application/xml";
_parser = null;
}
- public GomDocument () {}
- public GomDocument.from_path (string path) throws GLib.Error {
+ public Document () {}
+ public Document.from_path (string path) throws GLib.Error {
var file = GLib.File.new_for_path (path);
this.from_file (file);
}
@@ -88,14 +88,14 @@ public class GXml.GomDocument : GXml.Node,
/**
* Creates a document parsing a URI file.
*/
- public GomDocument.from_uri (string uri) throws GLib.Error {
+ public Document.from_uri (string uri) throws GLib.Error {
this.from_file (File.new_for_uri (uri));
}
/**
* Creates a document parsing a file.
*/
- public GomDocument.from_file (GLib.File file) throws GLib.Error {
+ public Document.from_file (GLib.File file) throws GLib.Error {
Parser parser = get_xml_parser ();
parser.read_file (file);
}
@@ -131,7 +131,7 @@ public class GXml.GomDocument : GXml.Node,
/**
* Creates a document parsing a stream.
*/
- public GomDocument.from_stream (GLib.InputStream stream) throws GLib.Error {
+ public Document.from_stream (GLib.InputStream stream) throws GLib.Error {
Parser parser = get_xml_parser ();
parser.read_stream (stream);
}
@@ -139,7 +139,7 @@ public class GXml.GomDocument : GXml.Node,
/**
* Creates a document parsing a string.
*/
- public GomDocument.from_string (string str) throws GLib.Error {
+ public Document.from_string (string str) throws GLib.Error {
Parser parser = get_xml_parser ();
parser.read_string (str);
}
@@ -217,7 +217,7 @@ public class GXml.GomDocument : GXml.Node,
}
public DomDocumentFragment create_document_fragment() {
- return new GomDocumentFragment (this);
+ return new DocumentFragment (this);
}
public DomText create_text_node (string data) throws GLib.Error {
return new GomText (this, data);
@@ -343,16 +343,16 @@ public class GXml.GomImplementation : GLib.Object, GXml.DomImplementation {
throws GLib.Error
{
- return new GomDocumentType.with_ids (new GomDocument (), qualified_name, public_id, system_id); // FIXME
+ return new DocumentType.with_ids (new Document (), qualified_name, public_id, system_id); // FIXME
}
public DomXMLDocument create_document (string? namespace,
string? qualified_name,
DomDocumentType? doctype = null)
throws GLib.Error
{
- var d = new GomDocument ();
+ var d = new Document ();
if (doctype != null)
- d.append_child (new GomDocumentType.with_ids (d,
+ d.append_child (new DocumentType.with_ids (d,
doctype.name,
doctype.public_id,
doctype.system_id));
@@ -365,7 +365,7 @@ public class GXml.GomImplementation : GLib.Object, GXml.DomImplementation {
}
-public class GXml.GomDocumentType : GXml.Node,
+public class GXml.DocumentType : GXml.Node,
GXml.DomChildNode,
GXml.DomDocumentType
{
@@ -381,19 +381,19 @@ public class GXml.GomDocumentType : GXml.Node,
_node_type = DomNode.NodeType.DOCUMENT_TYPE_NODE;
_local_name = "!DOCTYPE";
}
- public GomDocumentType (DomDocument doc, string name, string? public_id, string? system_id) {
+ public DocumentType (DomDocument doc, string name, string? public_id, string? system_id) {
_document = doc;
_name = name;
_public_id = public_id;
_system_id = system_id;
}
- public GomDocumentType.with_name (DomDocument doc, string name) {
+ public DocumentType.with_name (DomDocument doc, string name) {
_document = doc;
_name = name;
_public_id = "";
_system_id = "";
}
- public GomDocumentType.with_ids (DomDocument doc, string name, string public_id, string system_id) {
+ public DocumentType.with_ids (DomDocument doc, string name, string public_id, string system_id) {
_document = doc;
_name = name;
_public_id = public_id;
@@ -409,12 +409,12 @@ public class GXml.GomDocumentType : GXml.Node,
}
-public class GXml.GomDocumentFragment : GXml.Node,
+public class GXml.DocumentFragment : GXml.Node,
GXml.DomParentNode,
GXml.DomNonElementParentNode,
GXml.DomDocumentFragment
{
- public GomDocumentFragment (DomDocument doc) {
+ public DocumentFragment (DomDocument doc) {
_document = doc;
_node_type = DomNode.NodeType.DOCUMENT_FRAGMENT_NODE;
_local_name = "#document-fragment";
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index 7dd5d87..05f3181 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -117,42 +117,42 @@ public class GXml.GomElement : GXml.Node,
return yield parser.write_string_async ();
}
/**
- * Uses element's {@link GomDocument} to write an XML to a file, serializing it.
+ * Uses element's {@link GXml.Document} to write an XML to a file, serializing it.
*/
public void write_file (GLib.File f, Cancellable? cancellable = null) throws GLib.Error {
- (this.owner_document as GomDocument).write_file (f);
+ (this.owner_document as GXml.Document).write_file (f);
}
/**
- * Uses element's {@link GomDocument} to write asynchronically an XML to a file, serializing it.
+ * Uses element's {@link GXml.Document} to write asynchronically an XML to a file, serializing it.
*/
public async void write_file_async (GLib.File f, Cancellable? cancellable = null) throws GLib.Error {
- yield (this.owner_document as GomDocument).write_file_async (f);
+ yield (this.owner_document as GXml.Document).write_file_async (f);
}
/**
- * Uses element's {@link GomDocument} to write an XML to a stream, serializing it.
+ * Uses element's {@link GXml.Document} to write an XML to a stream, serializing it.
*/
public void write_stream (GLib.OutputStream stream) throws GLib.Error {
- (this.owner_document as GomDocument).write_stream (stream);
+ (this.owner_document as GXml.Document).write_stream (stream);
}
/**
- * Uses element's {@link GomDocument} to write an XML to a stream, serializing it.
+ * Uses element's {@link GXml.Document} to write an XML to a stream, serializing it.
*/
public async void write_stream_async (GLib.OutputStream stream, Cancellable? cancellable = null) throws
GLib.Error {
- yield (this.owner_document as GomDocument).write_stream_async (stream);
+ yield (this.owner_document as GXml.Document).write_stream_async (stream);
}
/**
* Creates an {@link GLib.InputStream} to write a string representation
- * in XML of {@link GomElement} using node's {@link GomDocument}
+ * in XML of {@link GomElement} using node's {@link GXml.Document}
*/
public InputStream create_stream () throws GLib.Error {
- return (this.owner_document as GomDocument).create_stream ();
+ return (this.owner_document as GXml.Document).create_stream ();
}
/**
* Creates an {@link GLib.InputStream} to write a string representation
- * in XML of {@link GomElement} using node's {@link GomDocument}
+ * in XML of {@link GomElement} using node's {@link GXml.Document}
*/
public async InputStream create_stream_async (Cancellable? cancellable = null) throws GLib.Error {
- return yield (this.owner_document as GomDocument).create_stream_async ();
+ return yield (this.owner_document as GXml.Document).create_stream_async ();
}
// DomNode overrides
public new string? lookup_prefix (string? nspace) {
diff --git a/gxml/Node.vala b/gxml/Node.vala
index b351cf2..1e1c23b 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -79,7 +79,7 @@ public class GXml.Node : Object,
get {
if (this is DomDocument) return (DomDocument) this;
if (_document == null) {
- _document = new GomDocument ();
+ _document = new GXml.Document ();
if (this is DomElement) {
try { _document.append_child (this); }
catch (GLib.Error e) { warning (e.message); }
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
index e199a88..0c19059 100644
--- a/gxml/XParser.vala
+++ b/gxml/XParser.vala
@@ -208,7 +208,7 @@ public class GXml.XParser : Object, GXml.Parser {
if (current_is_element () && (node is DomDocument))
read_child_element (node);
else {
- if (node is GomDocument) {
+ if (node is GXml.Document) {
read_child_nodes (node);
}
if (node is GomElement) {
@@ -416,7 +416,7 @@ public class GXml.XParser : Object, GXml.Parser {
if (pid != null) pid = pid.replace ("\"","").chomp ().strip ();
string sid = info.fetch_named ("sid");
if (sid != null) sid = sid.replace ("\"","").chomp ().strip ();
- n = new GomDocumentType (_document, tr.const_local_name (), pid, sid);
+ n = new GXml.DocumentType (_document, tr.const_local_name (), pid, sid);
parent.append_child (n);
break;
case Xml.ReaderType.DOCUMENT_FRAGMENT:
diff --git a/gxml/meson.build b/gxml/meson.build
index dda235b..310daef 100644
--- a/gxml/meson.build
+++ b/gxml/meson.build
@@ -40,6 +40,7 @@ valasources = files ([
'Attr.vala',
'Collections.vala',
'CssSelectorParser.vala',
+ 'Document.vala',
'DomAttr.vala',
'DomCharacter.vala',
'DomCollections.vala',
@@ -53,7 +54,6 @@ valasources = files ([
'Enumeration.vala',
'Event.vala',
'GomBaseCollection.vala',
- 'GomDocument.vala',
'GomElement.vala',
'GomHashMap.vala',
'GomHashPairedMap.vala',
diff --git a/test/CssSelectorTest.vala b/test/CssSelectorTest.vala
index 0a3f023..6994941 100644
--- a/test/CssSelectorTest.vala
+++ b/test/CssSelectorTest.vala
@@ -32,7 +32,7 @@ class CssSelectorTest : GXmlTest {
var s = cp.selectors[0];
assert (s != null);
assert (s.selector_type == CssSelectorType.ALL);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -51,7 +51,7 @@ class CssSelectorTest : GXmlTest {
var s = cp.selectors[0];
assert (s != null);
assert (s.selector_type == CssSelectorType.ELEMENT);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -74,7 +74,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -101,7 +101,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_CONTAINS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -136,7 +136,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_STARTS_WITH);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -171,7 +171,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_STARTS_WITH_WORD);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -206,7 +206,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_ENDS_WITH);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -241,7 +241,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_EQUAL);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -271,7 +271,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_EQUAL);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -297,7 +297,7 @@ class CssSelectorTest : GXmlTest {
var si = cp.selectors[0];
assert (si != null);
assert (si.selector_type == CssSelectorType.CLASS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -336,7 +336,7 @@ class CssSelectorTest : GXmlTest {
var sc = cp.selectors[1];
assert (sc != null);
assert (sc.selector_type == CssSelectorType.CLASS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("children");
@@ -375,7 +375,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.PSEUDO_CLASS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -429,7 +429,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.ATTRIBUTE_EQUAL);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("HTML");
d.append_child (r);
var c1 = d.create_element ("BODY");
@@ -456,7 +456,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.PSEUDO_CLASS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -521,7 +521,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.PSEUDO_CLASS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -593,7 +593,7 @@ class CssSelectorTest : GXmlTest {
var sa = cp.selectors[1];
assert (sa != null);
assert (sa.selector_type == CssSelectorType.PSEUDO_CLASS);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -661,7 +661,7 @@ class CssSelectorTest : GXmlTest {
var s = cp.selectors[0];
assert (s != null);
assert (s.selector_type == CssSelectorType.ELEMENT);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -697,7 +697,7 @@ class CssSelectorTest : GXmlTest {
var s = cp.selectors[0];
assert (s != null);
assert (s.selector_type == CssSelectorType.ELEMENT);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -737,7 +737,7 @@ class CssSelectorTest : GXmlTest {
var s = cp.selectors[0];
assert (s != null);
assert (s.selector_type == CssSelectorType.ELEMENT);
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("toplevel");
d.append_child (r);
var c1 = d.create_element ("child");
diff --git a/test/GomDocumentTest.vala b/test/DocumentTest.vala
similarity index 89%
rename from test/GomDocumentTest.vala
rename to test/DocumentTest.vala
index 2f21389..4d498ce 100644
--- a/test/GomDocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -1,5 +1,5 @@
/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
-/* GomDocumentTest.vala
+/* GXml.DocumentTest.vala
*
* Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
*
@@ -22,12 +22,12 @@
using GXml;
-class GomDocumentTest : GXmlTest {
- class ObjectDocument : GomDocument {
+class GXml.DocumentTest : GXmlTest {
+ class ObjectDocument : GXml.Document {
[Description (nick="::ROOT")]
public ObjectParent root_element { get; set; }
construct {
- var dt = new GomDocumentType (this, "svg", "-//W3C//DTD SVG 1.1//EN",
+ var dt = new GXml.DocumentType (this, "svg", "-//W3C//DTD SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
try { append_child (dt); } catch (GLib.Error e) { warning ("Error: "+e.message); }
}
@@ -58,7 +58,7 @@ class GomDocumentTest : GXmlTest {
public static void add_tests () {
Test.add_func ("/gxml/gom-document/construct_api", () => {
try {
- DomDocument d = new GomDocument ();
+ DomDocument d = new GXml.Document ();
DomElement r = d.create_element ("root");
assert (r is DomElement);
assert (r.local_name == "root");
@@ -77,17 +77,17 @@ class GomDocumentTest : GXmlTest {
try {
GLib.Test.message ("invalid file...");
// file does not exist
- doc = new GomDocument.from_path ("/tmp/asdfjlkansdlfjl");
+ doc = new GXml.Document.from_path ("/tmp/asdfjlkansdlfjl");
assert_not_reached ();
} catch {}
try {
// file exists, but is not XML (it's a directory!)
- doc = new GomDocument.from_path ("/tmp/");
+ doc = new GXml.Document.from_path ("/tmp/");
assert_not_reached ();
} catch {}
try {
- doc = new GomDocument.from_path ("test_invalid.xml");
+ doc = new GXml.Document.from_path ("test_invalid.xml");
assert_not_reached ();
} catch {}
});
@@ -96,7 +96,7 @@ class GomDocumentTest : GXmlTest {
assert (fin.query_exists ());
try {
var instream = fin.read (null);
- var doc = new GomDocument.from_stream (instream);
+ var doc = new GXml.Document.from_stream (instream);
assert (doc != null);
// TODO: CHECKS
} catch (GLib.Error e) {
@@ -110,7 +110,7 @@ class GomDocumentTest : GXmlTest {
if (f.query_exists ()) f.delete ();
var s = new GLib.StringBuilder ();
s.append ("""<document_element />""");
- var d = new GomDocument.from_string (s.str);
+ var d = new GXml.Document.from_string (s.str);
#if DEBUG
var parser = new XParser (d);
message ("Saving to file: "+f.get_uri ());
@@ -118,7 +118,7 @@ class GomDocumentTest : GXmlTest {
#endif
d.write_file (f);
assert (f.query_exists ());
- var d2 = new GomDocument.from_file (f);
+ var d2 = new GXml.Document.from_file (f);
assert (d2 != null);
assert (d2.document_element != null);
assert (d2.document_element.node_name == "document_element");
@@ -134,12 +134,12 @@ class GomDocumentTest : GXmlTest {
if (f.query_exists ()) f.delete ();
var s = new GLib.StringBuilder ();
s.append ("""<document_element />""");
- var d = new GomDocument.from_string (s.str);
+ var d = new GXml.Document.from_string (s.str);
var parser = new XParser (d);
Test.message ("Saving to file: "+f.get_uri ()+parser.write_string ());
d.write_file (f);
assert (f.query_exists ());
- var d2 = new GomDocument ();
+ var d2 = new GXml.Document ();
assert (d2 != null);
d2.read_from_file (f);
assert (d2.document_element != null);
@@ -157,7 +157,7 @@ class GomDocumentTest : GXmlTest {
GLib.message ("No remote file available. Skiping...");
return;
}
- var d = new GomDocument.from_file (rf);
+ var d = new GXml.Document.from_file (rf);
assert (d != null);
assert (d.document_element != null);
assert (d.document_element.node_name == "Project");
@@ -189,7 +189,7 @@ class GomDocumentTest : GXmlTest {
GLib.message ("No remote file available. Skiping...");
return;
}
- var d = new GomDocument.from_file (rf);
+ var d = new GXml.Document.from_file (rf);
assert (d != null);
assert (d.document_element != null);
var parser = new XParser (d);
@@ -210,7 +210,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/namespace/write", () => {
try {
- var doc = new GomDocument ();
+ var doc = new GXml.Document ();
var r = doc.create_element_ns ("http://live.gnome.org/GXml","root");
doc.append_child (r);
assert (r.prefix == null);
@@ -234,7 +234,7 @@ class GomDocumentTest : GXmlTest {
try {
fin = File.new_tmp ("gxml.XXXXXX", out iostream);
- doc = new GomDocument.from_stream (iostream.input_stream);
+ doc = new GXml.Document.from_stream (iostream.input_stream);
GLib.message ("Passed parse error stream");
assert_not_reached ();
} catch {}
@@ -246,7 +246,7 @@ class GomDocumentTest : GXmlTest {
GXml.DomNode document_element;
xml = "<Fruits><Apple></Apple><Orange></Orange></Fruits>";
- doc = new GomDocument.from_string (xml);
+ doc = new GXml.Document.from_string (xml);
assert (doc.document_element != null);
document_element = doc.document_element;
assert (document_element.node_name == "Fruits");
@@ -259,11 +259,11 @@ class GomDocumentTest : GXmlTest {
Test.add_func ("/gxml/gom-document/read_from_string", () => {
try {
string xml;
- GomDocument doc;
+ GXml.Document doc;
GXml.DomNode document_element;
xml = "<Fruits><Apple></Apple><Orange></Orange></Fruits>";
- doc = new GomDocument ();
+ doc = new GXml.Document ();
doc.read_from_string (xml);
assert (doc.document_element != null);
document_element = doc.document_element;
@@ -280,7 +280,7 @@ class GomDocumentTest : GXmlTest {
DomDocument doc;
xml = """<?xml version="1.0"?>""";
- doc = new GomDocument.from_string (xml);
+ doc = new GXml.Document.from_string (xml);
assert_not_reached ();
} catch {}
});
@@ -290,7 +290,7 @@ class GomDocumentTest : GXmlTest {
DomDocument doc;
xml = "";
- doc = new GomDocument.from_string (xml);
+ doc = new GXml.Document.from_string (xml);
assert_not_reached ();
} catch {}
});
@@ -298,9 +298,9 @@ class GomDocumentTest : GXmlTest {
DomDocument doc;
try {
- doc = new GomDocument.from_string ("<document_element />");
+ doc = new GXml.Document.from_string ("<document_element />");
var f = GLib.File.new_for_path
(GXmlTestConfig.TEST_SAVE_DIR+"/test_out_path.xml");
- (doc as GomDocument).write_file (f);
+ (doc as GXml.Document).write_file (f);
assert (f.query_exists ());
f.delete ();
} catch (GLib.Error e) {
@@ -312,15 +312,15 @@ class GomDocumentTest : GXmlTest {
DomDocument doc;
try {
- doc = new GomDocument.from_string ("<document_element />");
- (doc as GomDocument).write_file (GLib.File.new_for_path
("/tmp/a/b/c/d/e/f/g/h/i"));
+ doc = new GXml.Document.from_string ("<document_element />");
+ (doc as GXml.Document).write_file (GLib.File.new_for_path
("/tmp/a/b/c/d/e/f/g/h/i"));
assert_not_reached ();
} catch {}
});
Test.add_func ("/gxml/gom-document/create_element", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<document_element />");
+ DomDocument doc = new GXml.Document.from_string ("<document_element />");
DomElement elem = null;
elem = (DomElement) doc.create_element ("Banana");
assert (elem is DomElement);
@@ -333,7 +333,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/create_text_node", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<document_element />");
+ DomDocument doc = new GXml.Document.from_string ("<document_element />");
DomText text = (DomText) doc.create_text_node ("Star of my dreams");
assert (text is GomText);
assert (text is DomText);
@@ -344,7 +344,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/node_text_content", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<document_element />");
+ DomDocument doc = new GXml.Document.from_string ("<document_element />");
var r = doc.document_element;
assert (r != null);
assert (r.text_content == null);
@@ -356,7 +356,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/create_comment", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<document_element />");
+ DomDocument doc = new GXml.Document.from_string ("<document_element />");
DomComment comment = (GXml.DomComment) doc.create_comment ("Ever since the
day we promised.");
assert (comment.node_name == "#comment");
@@ -365,7 +365,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/create_processing_instruction", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<document_element />");
+ DomDocument doc = new GXml.Document.from_string ("<document_element />");
DomProcessingInstruction instruction = doc.create_processing_instruction
("target", "data");
assert (instruction is GomProcessingInstruction);
assert (instruction is DomProcessingInstruction);
@@ -382,7 +382,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/create_attribute", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<document_element />");
+ DomDocument doc = new GXml.Document.from_string ("<document_element />");
assert (doc.document_element != null);
((DomElement) doc.document_element).set_attribute ("attrname", "attrvalue");
assert (doc.document_element.attributes.size == 1);
@@ -398,7 +398,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/to_string/basic", () => {
try {
- DomDocument doc = new GomDocument.from_string ("<?xml version=\"1.0\"?>
+ DomDocument doc = new GXml.Document.from_string ("<?xml version=\"1.0\"?>
<Sentences><Sentence lang=\"en\">I like the colour blue.</Sentence><Sentence lang=\"de\">Ich liebe die
Tür.</Sentence><Authors><Author><Name>Fred</Name><Email>fweasley hogwarts co
uk</Email></Author><Author><Name>George</Name><Email>gweasley hogwarts co
uk</Email></Author></Authors></Sentences>");
var parser = new XParser (doc);
@@ -417,7 +417,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/to_string/extended", () => {
try {
- var d = new GomDocument.from_path
(GXmlTestConfig.TEST_DIR+"/gdocument-read.xml");
+ var d = new GXml.Document.from_path
(GXmlTestConfig.TEST_DIR+"/gdocument-read.xml");
#if DEBUG
var parser = new XParser (d);
GLib.message ("Document Read:"+parser.write_string ());
@@ -444,7 +444,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/namespace/create", () => {
try {
- DomDocument doc = new GomDocument.from_string
("<document_element><child/></document_element>");
+ DomDocument doc = new GXml.Document.from_string
("<document_element><child/></document_element>");
assert (doc.document_element != null);
assert (doc.document_element.namespace_uri == null);
@@ -469,7 +469,7 @@ class GomDocumentTest : GXmlTest {
.get_attribute_ns
("http://www.gnome.org/GXml2", "prop");
assert (p != null);
assert (p == "val");
- message ((doc as GomDocument).write_string ());
+ message ((doc as GXml.Document).write_string ());
assert (doc.document_element.lookup_namespace_uri (null) ==
"http://www.gnome.org/GXml");
assert (c.prefix == null);
assert (c.namespace_uri == null);
@@ -494,7 +494,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/namespace/read", () => {
try {
- DomDocument doc = new GomDocument.from_string ("""
+ DomDocument doc = new GXml.Document.from_string ("""
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
@@ -513,7 +513,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/namespace/invalid", () => {
DomDocument doc = null;
- try { doc = new GomDocument.from_string
("<document_element><child/></document_element>"); }
+ try { doc = new GXml.Document.from_string
("<document_element><child/></document_element>"); }
catch (GLib.Error e) { GLib.message ("ERROR: "+e.message); }
try {
doc.document_element.set_attribute_ns ("http://local",
@@ -559,12 +559,12 @@ class GomDocumentTest : GXmlTest {
assert (p == null);
});
Test.add_func ("/gxml/gom-document/parent", () => {
- var doc = new GomDocument ();
+ var doc = new GXml.Document ();
assert (doc.parent_node == null);
});
Test.add_func ("/gxml/gom-document/write/string", () => {
try {
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var n = d.create_element ("Node") as GomElement;
d.append_child (n);
n.set_attribute ("name","value");
@@ -582,7 +582,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/css-selector", () => {
try {
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -643,9 +643,9 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/doc-type/write/full", () => {
try {
- var d = new GomDocument ();
+ var d = new GXml.Document ();
message ("Creating a DocumentType");
- var dt1 = new GXml.GomDocumentType (d, "svg", "-//W3C//DTD SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
+ var dt1 = new GXml.DocumentType (d, "svg", "-//W3C//DTD SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
assert (dt1 is DomDocumentType);
assert (dt1.node_type == DomNode.NodeType.DOCUMENT_TYPE_NODE);
assert (dt1.node_name == "!DOCTYPE");
@@ -666,9 +666,9 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/doc-type/write/no-ids", () => {
try {
- var d = new GomDocument ();
+ var d = new GXml.Document ();
message ("Creating a DocumentType");
- var dt1 = new GXml.GomDocumentType (d, "svg", null, null);
+ var dt1 = new GXml.DocumentType (d, "svg", null, null);
assert (dt1 is DomDocumentType);
assert (dt1.node_type == DomNode.NodeType.DOCUMENT_TYPE_NODE);
assert (dt1.node_name == "!DOCTYPE");
@@ -689,7 +689,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/doc-type/read/full", () => {
try {
- var d = new GomDocument.from_string ("<?xml version=\"1.0\"?>\n<!DOCTYPE svg
PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"><svg/>");
+ var d = new GXml.Document.from_string ("<?xml version=\"1.0\"?>\n<!DOCTYPE
svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"><svg/>");
message (d.write_string ());
message (d.child_nodes.length.to_string ());
assert (d.child_nodes.length == 2);
@@ -708,7 +708,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/doc-type/read/spaces", () => {
try {
- var d = new GomDocument.from_string ("<?xml version=\"1.0\"?>\n<!DOCTYPE
svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"
<svg/>");
+ var d = new GXml.Document.from_string ("<?xml version=\"1.0\"?>\n<!DOCTYPE
svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"
<svg/>");
message (d.write_string ());
message (d.child_nodes.length.to_string ());
assert (d.child_nodes.length == 2);
@@ -727,7 +727,7 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/doc-type/read/no-ids", () => {
try {
- var d = new GomDocument.from_string ("<?xml version=\"1.0\"?>\n<!DOCTYPE
svg ><svg/>");
+ var d = new GXml.Document.from_string ("<?xml version=\"1.0\"?>\n<!DOCTYPE
svg ><svg/>");
message (d.write_string ());
message (d.child_nodes.length.to_string ());
assert (d.child_nodes.length == 2);
@@ -746,9 +746,9 @@ class GomDocumentTest : GXmlTest {
});
Test.add_func ("/gxml/gom-document/element-id", () => {
try {
- var d = new GomDocument.from_string ("""<root><child id="id1"/><child
id="id2"/></root>""") as DomDocument;
+ var d = new GXml.Document.from_string ("""<root><child id="id1"/><child
id="id2"/></root>""") as DomDocument;
message ("Serialize Document");
- message ((d as GomDocument).write_string ());
+ message ((d as GXml.Document).write_string ());
var e = d.get_element_by_id ("id1");
assert (e != null);
} catch (GLib.Error e) {
diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala
index a09e10e..ada2355 100644
--- a/test/GXmlTest.vala
+++ b/test/GXmlTest.vala
@@ -34,7 +34,7 @@ class GXmlTest {
XHtmlDocumentTest.add_tests ();
DomXDocumentTest.add_tests ();
XPathTest.add_tests ();
- GomDocumentTest.add_tests ();
+ DocumentTest.add_tests ();
GomElementTest.add_tests ();
GomSerializationTest.add_tests ();
GomSchemaTest.add_tests ();
diff --git a/test/GomDocumentPerformanceTest.vala b/test/GomDocumentPerformanceTest.vala
index 070616e..272ffdc 100644
--- a/test/GomDocumentPerformanceTest.vala
+++ b/test/GomDocumentPerformanceTest.vala
@@ -29,7 +29,7 @@ class GXmlTest.Suite : Object
Test.init (ref args);
Test.add_func ("/gxml/gom-document/performance", () => {
try {
- DomDocument d = new GomDocument ();
+ DomDocument d = new GXml.Document ();
File dir = File.new_for_path (GXmlTestConfig.TEST_DIR);
assert (dir.query_exists ());
File f = File.new_for_uri (dir.get_uri ()+"/test-large.xml");
diff --git a/test/GomElementTest.vala b/test/GomElementTest.vala
index a5faf63..bd0f972 100644
--- a/test/GomElementTest.vala
+++ b/test/GomElementTest.vala
@@ -212,7 +212,7 @@ class GomElementTest : GXmlTest {
Test.add_func ("/gxml/gom-element/read/namespace_uri", () => {
DomDocument doc = null;
try {
- doc = new GomDocument.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"><ingredient
products:name=\"spider\"/></magic:Potion></Potions>");
+ doc = new GXml.Document.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"><ingredient
products:name=\"spider\"/></magic:Potion></Potions>");
GXml.Node root = (GXml.Node) doc.document_element;
assert (root != null);
assert (root.node_name == "Potions");
@@ -239,7 +239,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/namespace_uri", () => {
try {
- GomDocument doc = new GomDocument.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\"
xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
+ GXml.Document doc = new GXml.Document.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\"
xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
GXml.Node root = (GXml.Node) doc.document_element;
assert (root != null);
assert (root.node_name == "Potions");
@@ -274,7 +274,7 @@ class GomElementTest : GXmlTest {
});Test.add_func ("/gxml/gom-element/read/namespace/redefinition", () => {
DomDocument doc = null;
try {
- doc = new GomDocument.from_string ("<magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\"
xmlns:products=\"http://hogwarts.co.uk/magic\"><magic:Arc/><products:Diamond/></magic:Potion>");
+ doc = new GXml.Document.from_string ("<magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\"
xmlns:products=\"http://hogwarts.co.uk/magic\"><magic:Arc/><products:Diamond/></magic:Potion>");
var r = doc.document_element;
assert (r != null);
assert (r.local_name == "Potion");
@@ -299,7 +299,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/attributes", () => {
try {
- GomDocument doc = new GomDocument.from_string ("<root />");
+ GXml.Document doc = new GXml.Document.from_string ("<root />");
assert (doc.document_element != null);
GomElement elem = (GomElement) doc.create_element ("alphanumeric");
doc.document_element.child_nodes.add (elem);
@@ -429,7 +429,7 @@ class GomElementTest : GXmlTest {
</class>
</namespace>
</repository>""";
- var d = new GomDocument.from_string (str);
+ var d = new GXml.Document.from_string (str);
assert (d.document_element.node_name == "repository");
var lt = d.document_element.get_elements_by_tag_name ("class");
assert (lt.length == 1);
@@ -444,7 +444,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/content/add_aside_child_nodes", () =>{
try {
- var doc = new GomDocument ();
+ var doc = new GXml.Document ();
var root = (GomElement) doc.create_element ("root");
doc.child_nodes.add (root);
var n = (GomElement) doc.create_element ("child");
@@ -461,7 +461,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/content/keep_child_nodes", () =>{
try {
- var doc = new GomDocument ();
+ var doc = new GXml.Document ();
var root = (GomElement) doc.create_element ("root");
doc.child_nodes.add (root);
var n = (GomElement) doc.create_element ("child");
@@ -478,7 +478,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/parent", () => {
try {
- var doc = new GomDocument.from_string ("<root><child/></root>");
+ var doc = new GXml.Document.from_string ("<root><child/></root>");
assert (doc.document_element != null);
assert (doc.document_element.parent_node is GXml.DomNode);
assert (doc.document_element.parent_node is GXml.DomDocument);
@@ -492,7 +492,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/remove", () => {
try {
- var doc = new GomDocument.from_string ("<root><child/></root>");
+ var doc = new GXml.Document.from_string ("<root><child/></root>");
assert (doc.document_element != null);
assert (doc.document_element.parent_node is GXml.DomNode);
assert (doc.document_element.parent_node is GXml.DomDocument);
@@ -574,7 +574,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/previous_element_sibling", () => {
try {
- var doc = new GomDocument.from_string ("<root> <child/> <child/></root>");
+ var doc = new GXml.Document.from_string ("<root> <child/> <child/></root>");
assert (doc.document_element != null);
assert (doc.document_element.parent_node is GXml.DomNode);
assert (doc.document_element.parent_node is GXml.DomDocument);
@@ -605,7 +605,7 @@ class GomElementTest : GXmlTest {
});
Test.add_func ("/gxml/gom-element/css-selector", () => {
try {
- var d = new GomDocument ();
+ var d = new GXml.Document ();
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
diff --git a/test/meson.build b/test/meson.build
index f05606c..359101b 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -9,7 +9,7 @@ files_tests = files ([
'ValaLibxml2Test.vala',
'XHtmlDocumentTest.vala',
'DomXDocumentTest.vala',
- 'GomDocumentTest.vala',
+ 'DocumentTest.vala',
'GomElementTest.vala',
'GomSerializationTest.vala',
'GomSchemaTest.vala',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]