[gxml] XDocument: renamed from GDocument
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] XDocument: renamed from GDocument
- Date: Fri, 5 Jul 2019 05:09:53 +0000 (UTC)
commit 4f684c67159c9b68f222d857c82b3a9d3a2535b6
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Jul 4 23:15:55 2019 -0500
XDocument: renamed from GDocument
gxml/GHtml.vala | 2 +-
gxml/GXPathObject.vala | 2 +-
gxml/GXmlListNamespaces.vala | 4 +--
gxml/GXmlNode.vala | 10 +++---
gxml/GXmlParser.vala | 4 +--
gxml/XAttribute.vala | 4 +--
gxml/XChildNode.vala | 4 +--
gxml/XComment.vala | 2 +-
gxml/{GXmlDocument.vala => XDocument.vala} | 38 +++++++++++-----------
gxml/XElement.vala | 4 +--
gxml/XHashMapAttr.vala | 12 +++----
gxml/XListChildren.vala | 8 ++---
gxml/XProcessingInstruction.vala | 2 +-
gxml/XText.vala | 2 +-
gxml/meson.build | 2 +-
test/CssSelectorTest.vala | 8 ++---
...st.vala => DocumentPerformanceIterateTest.vala} | 0
...manceTest.vala => DocumentPerformanceTest.vala} | 4 +--
...DomGDocumentTest.vala => DomXDocumentTest.vala} | 32 +++++++++---------
test/GHtmlDocumentTest.vala | 2 +-
test/GXmlTest.vala | 2 +-
test/{GElementTest.vala => XElementTest.vala} | 8 ++---
test/XPathTest.vala | 4 +--
test/meson.build | 12 +++----
24 files changed, 86 insertions(+), 86 deletions(-)
---
diff --git a/gxml/GHtml.vala b/gxml/GHtml.vala
index a260ff5..ecc7082 100644
--- a/gxml/GHtml.vala
+++ b/gxml/GHtml.vala
@@ -29,7 +29,7 @@ namespace GXml {
/**
* HML parsing suport. Document handling
*/
- public class GHtmlDocument : GDocument, DomHtmlDocument {
+ public class GHtmlDocument : XDocument, DomHtmlDocument {
public static int default_options {
get {
return Html.ParserOption.NONET | Html.ParserOption.NOWARNING |
Html.ParserOption.NOERROR | Html.ParserOption.NOBLANKS;
diff --git a/gxml/GXPathObject.vala b/gxml/GXPathObject.vala
index db2ac1e..9ce96b0 100644
--- a/gxml/GXPathObject.vala
+++ b/gxml/GXPathObject.vala
@@ -29,7 +29,7 @@ public class GXml.GXPathObject : GLib.Object, GXml.XPathObject {
private string _string_value;
private double _number_value;
- public GXPathObject (GXml.GDocument document, Xml.XPath.Object* pointer) {
+ public GXPathObject (GXml.XDocument document, Xml.XPath.Object* pointer) {
_collection = new GXml.GDomHTMLCollection();
_object_type = (GXml.XPathObjectType) pointer->type;
diff --git a/gxml/GXmlListNamespaces.vala b/gxml/GXmlListNamespaces.vala
index 2bbcab7..2ebae09 100644
--- a/gxml/GXmlListNamespaces.vala
+++ b/gxml/GXmlListNamespaces.vala
@@ -27,9 +27,9 @@ using Gee;
*/
public class GXml.GListNamespaces : Gee.AbstractList<GXml.Namespace>
{
- private GDocument _doc;
+ private XDocument _doc;
private Xml.Node *_node;
- public GListNamespaces (GDocument doc, Xml.Node *node) {
+ public GListNamespaces (XDocument doc, Xml.Node *node) {
_node = node;
_doc = doc;
}
diff --git a/gxml/GXmlNode.vala b/gxml/GXmlNode.vala
index ceb8715..9c94df6 100644
--- a/gxml/GXmlNode.vala
+++ b/gxml/GXmlNode.vala
@@ -36,7 +36,7 @@ public abstract class GXml.GNode : Object,
GXml.DomEventTarget,
GXml.DomNode
{
- protected GXml.GDocument _doc;
+ protected GXml.XDocument _doc;
protected Xml.Node *_node;
internal static string libxml2_error_to_string (Xml.Error *e) {
@@ -64,7 +64,7 @@ public abstract class GXml.GNode : Object,
owned get {
GXml.DomNode nullnode = null;
if (_node == null) return nullnode;
- return to_gnode (document as GDocument, _node->parent);
+ return to_gnode (document as XDocument, _node->parent);
}
}
public virtual GXml.NodeType type_node {
@@ -93,7 +93,7 @@ public abstract class GXml.GNode : Object,
public virtual string to_string () { return get_type ().name (); }
public Xml.Node* get_internal_node () { return _node; }
// Static
- public static GXml.DomNode to_gnode (GXml.GDocument doc, Xml.Node *node) {
+ public static GXml.DomNode to_gnode (GXml.XDocument doc, Xml.Node *node) {
GXml.DomNode nullnode = null;
var t = (GXml.NodeType) node->type;
switch (t) {
@@ -112,7 +112,7 @@ public abstract class GXml.GNode : Object,
case GXml.NodeType.COMMENT:
return new XComment (doc, node);
case GXml.NodeType.DOCUMENT:
- return new GDocument.from_doc (node->doc);
+ return new XDocument.from_doc (node->doc);
case GXml.NodeType.DOCUMENT_TYPE:
return nullnode;
case GXml.NodeType.DOCUMENT_FRAGMENT:
@@ -162,7 +162,7 @@ public abstract class GXml.GNode : Object,
public DomDocument? owner_document {
get { return _doc; }
- construct set { _doc = value as GDocument; }
+ construct set { _doc = value as XDocument; }
}
public DomNode? parent_node { owned get { return parent as DomNode?; } }
public DomElement? parent_element {
diff --git a/gxml/GXmlParser.vala b/gxml/GXmlParser.vala
index ca205a6..bf68e0d 100644
--- a/gxml/GXmlParser.vala
+++ b/gxml/GXmlParser.vala
@@ -22,10 +22,10 @@
private class GXml.GParser : Object, Parser {
- private GDocument document;
+ private XDocument document;
private DomNode _node;
- public GParser (GDocument doc) {
+ public GParser (XDocument doc) {
document = doc;
_node = doc;
}
diff --git a/gxml/XAttribute.vala b/gxml/XAttribute.vala
index eb4f155..cfbf2f1 100644
--- a/gxml/XAttribute.vala
+++ b/gxml/XAttribute.vala
@@ -27,7 +27,7 @@ using Gee;
public class GXml.XAttribute : GXml.GNode, GXml.DomAttr
{
private Xml.Attr* _attr;
- public XAttribute (GDocument doc, Xml.Attr *node)
+ public XAttribute (XDocument doc, Xml.Attr *node)
{
_attr = node;
_node = _attr->parent;
@@ -98,7 +98,7 @@ public class GXml.XAttribute : GXml.GNode, GXml.DomAttr
owned get {
GXml.DomNode nullnode = null;
if (_attr == null) return nullnode;
- return to_gnode (document as GDocument, _node);
+ return to_gnode (document as XDocument, _node);
}
}
// DomAttr implementation
diff --git a/gxml/XChildNode.vala b/gxml/XChildNode.vala
index d1def58..43e3cbe 100644
--- a/gxml/XChildNode.vala
+++ b/gxml/XChildNode.vala
@@ -45,7 +45,7 @@ public class GXml.XNonDocumentChildNode : GXml.XChildNode,
if (_node == null) return null;
var n = _node->previous_element_sibling ();
if (n == null) return null;
- return new XElement (owner_document as GDocument, n);
+ return new XElement (owner_document as XDocument, n);
}
}
public DomElement? next_element_sibling {
@@ -53,7 +53,7 @@ public class GXml.XNonDocumentChildNode : GXml.XChildNode,
if (_node == null) return null;
var n = _node->next_element_sibling ();
if (n == null) return null;
- return new XElement (owner_document as GDocument, n);
+ return new XElement (owner_document as XDocument, n);
}
}
}
diff --git a/gxml/XComment.vala b/gxml/XComment.vala
index 119320d..ca2bebf 100644
--- a/gxml/XComment.vala
+++ b/gxml/XComment.vala
@@ -26,7 +26,7 @@ using Gee;
*/
public class GXml.XComment : GXml.XCharacterData, GXml.DomComment
{
- public XComment (GDocument doc, Xml.Node *node)
+ public XComment (XDocument doc, Xml.Node *node)
{
_node = node;
_doc = doc;
diff --git a/gxml/GXmlDocument.vala b/gxml/XDocument.vala
similarity index 94%
rename from gxml/GXmlDocument.vala
rename to gxml/XDocument.vala
index 3c4f5ef..53452da 100644
--- a/gxml/GXmlDocument.vala
+++ b/gxml/XDocument.vala
@@ -1,5 +1,5 @@
/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
-/* GDocument.vala
+/* XDocument.vala
*
* Copyright (C) 2016-2019 Daniel Espinosa <esodan gmail com>
*
@@ -30,7 +30,7 @@ using Xml;
* This class use {@link Xml.TextWriter} to write down XML documents using
* its contained {@link GXml.DomNode} children or other XML structures.
*/
-public class GXml.GDocument : GXml.GNode,
+public class GXml.XDocument : GXml.GNode,
GXml.DomParentNode,
GXml.DomNonElementParentNode,
GXml.DomDocument,
@@ -41,18 +41,18 @@ public class GXml.GDocument : GXml.GNode,
protected Xml.Buffer _buffer;
protected Parser _parser = null;
- public GDocument () {
+ public XDocument () {
doc = new Xml.Doc ();
}
- public GDocument.from_path (string path, int options = 0) throws GLib.Error {
+ public XDocument.from_path (string path, int options = 0) throws GLib.Error {
this.from_file (File.new_for_path (path), options);
}
- public GDocument.from_uri (string uri, int options = 0) throws GLib.Error {
+ public XDocument.from_uri (string uri, int options = 0) throws GLib.Error {
this.from_file (File.new_for_uri (uri), options);
}
- public GDocument.from_file (GLib.File file, int options = 0, Cancellable? cancel = null) throws GLib.Error
{
+ public XDocument.from_file (GLib.File file, int options = 0, Cancellable? cancel = null) throws GLib.Error
{
if (!file.query_exists ())
throw new DomDocumentError.INVALID_DOCUMENT_ERROR (_("File doesn't exist"));
var parser = new GParser (this);
@@ -60,15 +60,15 @@ public class GXml.GDocument : GXml.GNode,
parser.read_stream (file.read ());
}
- public GDocument.from_string (string str, int options = 0) throws GLib.Error {
+ public XDocument.from_string (string str, int options = 0) throws GLib.Error {
var parser = new GParser (this);
parser.read_string (str);
}
- public GDocument.from_stream (GLib.InputStream istream) throws GLib.Error {
+ public XDocument.from_stream (GLib.InputStream istream) throws GLib.Error {
var parser = new GParser (this);
parser.read_stream (istream);
}
- public GDocument.from_doc (Xml.Doc doc) { this.doc = doc; }
+ public XDocument.from_doc (Xml.Doc doc) { this.doc = doc; }
public Parser GXml.DomDocument.get_xml_parser () {
if (_parser != null) {
@@ -117,7 +117,7 @@ public class GXml.GDocument : GXml.GNode,
if (found > 1) {
GLib.warning ("Document have more than one root GXmlElement. Using first found");
}
- }
+ }
return new XElement (this, r);
}
}
@@ -142,7 +142,7 @@ public class GXml.GDocument : GXml.GNode,
}
}
/**
- * Uses libxml2 internal dump to memory function over owned
+ * Uses libxml2 internal dump to memory function over owned
*/
public string libxml_to_string () {
string buffer;
@@ -235,7 +235,7 @@ public class GXml.GDocument : GXml.GNode,
}
public DomDocumentFragment create_document_fragment() {
- return new GDocumentFragment (this);
+ return new XDocumentFragment (this);
}
public DomText create_text_node (string data) throws GLib.Error {
return (DomText) create_text (data);
@@ -375,20 +375,20 @@ public class GXml.GImplementation : GLib.Object, GXml.DomImplementation {
create_document_type (string qualified_name, string public_id, string system_id)
throws GLib.Error
{
- return new GDocumentType.with_ids (qualified_name, public_id, system_id); // FIXME
+ return new XDocumentType.with_ids (qualified_name, public_id, system_id); // FIXME
}
public DomXMLDocument create_document (string? namespace,
string? qualified_name,
DomDocumentType? doctype = null)
throws GLib.Error
- { return new GDocument (); } // FIXME
+ { return new XDocument (); } // FIXME
public DomDocument create_html_document (string title) {
return new GHtmlDocument (); // FIXME:
}
}
-public class GXml.GDocumentType : GXml.XChildNode,
+public class GXml.XDocumentType : GXml.XChildNode,
GXml.DomNode,
GXml.DomChildNode,
GXml.DomDocumentType
@@ -401,12 +401,12 @@ public class GXml.GDocumentType : GXml.XChildNode,
public string public_id { get { return _public_id; } }
public string system_id { get { return _system_id; } }
- public GDocumentType.with_name (string name) {
+ public XDocumentType.with_name (string name) {
_name = name;
_public_id = "";
_system_id = "";
}
- public GDocumentType.with_ids (string name, string public_id, string system_id) {
+ public XDocumentType.with_ids (string name, string public_id, string system_id) {
_name = name;
_public_id = public_id;
_system_id = system_id;
@@ -417,10 +417,10 @@ public class GXml.GDocumentType : GXml.XChildNode,
}
}
-public class GXml.GDocumentFragment : GXml.GDocument,
+public class GXml.XDocumentFragment : GXml.XDocument,
GXml.DomDocumentFragment
{
- public GDocumentFragment (GXml.GDocument d) {
+ public XDocumentFragment (GXml.XDocument d) {
_doc = d._doc; // FIXME: https://www.w3.org/TR/dom/#dom-document-createdocumentfragment
}
}
diff --git a/gxml/XElement.vala b/gxml/XElement.vala
index 7125770..c2c09bd 100644
--- a/gxml/XElement.vala
+++ b/gxml/XElement.vala
@@ -33,7 +33,7 @@ public class GXml.XElement : GXml.XNonDocumentChildNode,
GXml.DomElement,
GXml.XPathContext
{
- public XElement (GDocument doc, Xml.Node *node) {
+ public XElement (XDocument doc, Xml.Node *node) {
_node = node;
_doc = doc;
}
@@ -338,7 +338,7 @@ public class GXml.XElement : GXml.XNonDocumentChildNode,
return nullobj;
string data = (this as GXml.GNode).to_string();
var ndoc = Xml.Parser.read_memory (data, data.length);
- var gdoc = new GXml.GDocument.from_doc (ndoc);
+ var gdoc = new GXml.XDocument.from_doc (ndoc);
var context = new Xml.XPath.Context (ndoc);
if (resolver != null)
resolver.foreach (ns => {
diff --git a/gxml/XHashMapAttr.vala b/gxml/XHashMapAttr.vala
index 67d89cc..0fe2fa3 100644
--- a/gxml/XHashMapAttr.vala
+++ b/gxml/XHashMapAttr.vala
@@ -29,18 +29,18 @@ using Gee;
public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.GNode>,
GXml.DomNamedNodeMap
{
- private GDocument _doc;
+ private XDocument _doc;
private Xml.Node *_node;
- public XHashMapAttr (GDocument doc, Xml.Node *node) {
+ public XHashMapAttr (XDocument doc, Xml.Node *node) {
_node = node;
_doc = doc;
}
public class Entry : Gee.Map.Entry<string,GXml.GNode> {
- private GXml.GDocument _doc;
+ private GXml.XDocument _doc;
private Xml.Attr *_attr;
private XAttribute oattr;
- public Entry (GDocument doc, Xml.Attr *attr) {
+ public Entry (XDocument doc, Xml.Attr *attr) {
_attr = attr;
_doc = doc;
oattr = new XAttribute (_doc, _attr);
@@ -161,11 +161,11 @@ public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.GNode>,
}
}
public class Iterator : Object, MapIterator<string,GXml.GNode> {
- private GXml.GDocument _doc;
+ private GXml.XDocument _doc;
private Xml.Node *_node;
private Xml.Attr *_current;
- public Iterator (GXml.GDocument doc, Xml.Node *node) {
+ public Iterator (GXml.XDocument doc, Xml.Node *node) {
_node = node;
_current = null;
_doc = doc;
diff --git a/gxml/XListChildren.vala b/gxml/XListChildren.vala
index bdfb263..a37697f 100644
--- a/gxml/XListChildren.vala
+++ b/gxml/XListChildren.vala
@@ -28,9 +28,9 @@ using Gee;
public class GXml.XListChildren : AbstractBidirList<GXml.DomNode>,
DomNodeList, DomHTMLCollection
{
- private GXml.GDocument _doc;
+ private GXml.XDocument _doc;
private Xml.Node *_node;
- public XListChildren (GDocument doc, Xml.Node* node) {
+ public XListChildren (XDocument doc, Xml.Node* node) {
_node = node;
_doc = doc;
}
@@ -159,11 +159,11 @@ public class GXml.XListChildren : AbstractBidirList<GXml.DomNode>,
Gee.BidirIterator<GXml.DomNode>,
Gee.ListIterator<GXml.DomNode>,
BidirListIterator<GXml.DomNode> {
- private GDocument _doc;
+ private XDocument _doc;
private Xml.Node *_node;
private Xml.Node *_current;
private int i = 0;
- public Iterator (GDocument doc, Xml.Node *node) {
+ public Iterator (XDocument doc, Xml.Node *node) {
_node = node;
_current = _node->children;
_doc = doc;
diff --git a/gxml/XProcessingInstruction.vala b/gxml/XProcessingInstruction.vala
index b8b50c1..5363f8a 100644
--- a/gxml/XProcessingInstruction.vala
+++ b/gxml/XProcessingInstruction.vala
@@ -28,7 +28,7 @@ using Gee;
public class GXml.XProcessingInstruction : GXml.XCharacterData,
GXml.DomProcessingInstruction
{
- public XProcessingInstruction (GDocument doc, Xml.Node *node)
+ public XProcessingInstruction (XDocument doc, Xml.Node *node)
{
_node = node;
_doc = doc;
diff --git a/gxml/XText.vala b/gxml/XText.vala
index 7b8a97d..f5eabff 100644
--- a/gxml/XText.vala
+++ b/gxml/XText.vala
@@ -27,7 +27,7 @@ using Gee;
*/
public class GXml.XText : GXml.XCharacterData, GXml.DomText
{
- public XText (GDocument doc, Xml.Node *node)
+ public XText (XDocument doc, Xml.Node *node)
{
_node = node;
_doc = doc;
diff --git a/gxml/meson.build b/gxml/meson.build
index 0bc123d..95fc410 100644
--- a/gxml/meson.build
+++ b/gxml/meson.build
@@ -67,7 +67,6 @@ valasources = files ([
'GomSchema.vala',
'GomStringRef.vala',
'GomText.vala',
- 'GXmlDocument.vala',
'gxml-init.vala',
'GXmlListNamespaces.vala',
'GXmlNamespace.vala',
@@ -82,6 +81,7 @@ valasources = files ([
'XCharacter.vala',
'XChildNode.vala',
'XComment.vala',
+ 'XDocument.vala',
'XElement.vala',
'XHashMapAttr.vala',
'XListChildren.vala',
diff --git a/test/CssSelectorTest.vala b/test/CssSelectorTest.vala
index 5295adb..0a3f023 100644
--- a/test/CssSelectorTest.vala
+++ b/test/CssSelectorTest.vala
@@ -394,7 +394,7 @@ class CssSelectorTest : GXmlTest {
assert (!cp.match (c2));
assert (!cp.match (c3));
assert (!cp.match (c4));
- var d2 = new GDocument () as DomDocument;
+ var d2 = new XDocument () as DomDocument;
var r2 = d2.create_element ("toplevel");
d2.append_child (r2);
var c1g = d2.create_element ("child");
@@ -483,7 +483,7 @@ class CssSelectorTest : GXmlTest {
assert (cp.match (c3));
assert (!cp.match (c4));
assert (!cp.match (c5));
- var d2 = new GDocument () as DomDocument;
+ var d2 = new XDocument () as DomDocument;
var r2 = d2.create_element ("toplevel");
d2.append_child (r2);
var c1g = d2.create_element ("child");
@@ -552,7 +552,7 @@ class CssSelectorTest : GXmlTest {
assert (!cp.match (c4));
assert (cp.match (c5));
assert (cp.match (c6));
- var d2 = new GDocument () as DomDocument;
+ var d2 = new XDocument () as DomDocument;
var r2 = d2.create_element ("toplevel");
d2.append_child (r2);
var c1g = d2.create_element ("child");
@@ -621,7 +621,7 @@ class CssSelectorTest : GXmlTest {
assert (cp.match (c5));
assert (!cp.match (c6));
assert (cp.match (c7));
- var d2 = new GDocument () as DomDocument;
+ var d2 = new XDocument () as DomDocument;
var r2 = d2.create_element ("toplevel");
d2.append_child (r2);
var c1g = d2.create_element ("child");
diff --git a/test/GXmlDocumentPerformanceIterateTest.vala b/test/DocumentPerformanceIterateTest.vala
similarity index 100%
rename from test/GXmlDocumentPerformanceIterateTest.vala
rename to test/DocumentPerformanceIterateTest.vala
diff --git a/test/GXmlDocumentPerformanceTest.vala b/test/DocumentPerformanceTest.vala
similarity index 94%
rename from test/GXmlDocumentPerformanceTest.vala
rename to test/DocumentPerformanceTest.vala
index b5b60e4..da4b2df 100644
--- a/test/GXmlDocumentPerformanceTest.vala
+++ b/test/DocumentPerformanceTest.vala
@@ -27,9 +27,9 @@ class GXmlTest.Suite : Object
{
GLib.Intl.setlocale (GLib.LocaleCategory.ALL, "");
Test.init (ref args);
- Test.add_func ("/gxml/g-document/performance", () => {
+ Test.add_func ("/gxml/x-document/performance", () => {
try {
- DomDocument d = new GDocument ();
+ DomDocument d = new XDocument ();
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/DomGDocumentTest.vala b/test/DomXDocumentTest.vala
similarity index 95%
rename from test/DomGDocumentTest.vala
rename to test/DomXDocumentTest.vala
index 9c97766..55bf62c 100644
--- a/test/DomGDocumentTest.vala
+++ b/test/DomXDocumentTest.vala
@@ -1,5 +1,5 @@
/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
-/* DomGDocumentTest.vala
+/* DomXDocumentTest.vala
*
* Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
*
@@ -22,7 +22,7 @@
using GXml;
-class DomGDocumentTest : GXmlTest {
+class DomXDocumentTest : GXmlTest {
const string STRDOC = "<?xml version=\"1.0\"?>
<!-- Comment -->
@@ -71,7 +71,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+STRDOC);
#endif
- var doc = new GDocument.from_string (STRDOC) as DomDocument;
+ var doc = new XDocument.from_string (STRDOC) as DomDocument;
DomElement root = doc.document_element;
assert (root != null);
assert (root is DomElement);
@@ -91,7 +91,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+STRDOC);
#endif
- var doc = new GDocument.from_string (STRDOC) as DomDocument;
+ var doc = new XDocument.from_string (STRDOC) as DomDocument;
assert (doc is DomDocument);
assert (doc.child_nodes != null);
assert (doc.child_nodes.size == 2);
@@ -114,7 +114,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+STRDOC);
#endif
- var doc = new GDocument.from_string (HTMLDOC) as DomDocument;
+ var doc = new XDocument.from_string (HTMLDOC) as DomDocument;
assert (doc is DomDocument);
var le = doc.get_elements_by_tag_name ("p");
assert (le.size == 4);
@@ -122,7 +122,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
assert (le[1].get_attribute ("id") == "p01");
var lc = doc.get_elements_by_class_name ("black");
#if DEBUG
- GLib.message ("DOC\n"+(doc as GDocument).to_string ());
+ GLib.message ("DOC\n"+(doc as XDocument).to_string ());
#endif
assert (lc.size == 2);
assert (lc[0].node_name == "p");
@@ -139,7 +139,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
Test.add_func ("/gxml/dom/element/element_collections", () => {
try {
GLib.message ("Doc: "+HTMLDOC);
- var doc = new GDocument.from_string (HTMLDOC) as DomDocument;
+ var doc = new XDocument.from_string (HTMLDOC) as DomDocument;
assert (doc is DomDocument);
assert (doc.document_element.children.size == 1);
var le = doc.document_element.get_elements_by_tag_name ("p");
@@ -166,7 +166,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
});
Test.add_func ("/gxml/dom/node", () => {
try {
- var doc = new GDocument.from_string (HTMLDOC) as DomDocument;
+ var doc = new XDocument.from_string (HTMLDOC) as DomDocument;
assert (doc is DomDocument);
message (doc.write_string ());
assert (doc.document_element.children.size == 1);
@@ -342,7 +342,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+HTMLDOC);
#endif
- var doc = new GDocument.from_string (HTMLDOC) as DomDocument;
+ var doc = new XDocument.from_string (HTMLDOC) as DomDocument;
assert (doc is DomDocument);
assert (doc.document_element.children.size == 1);
var n1 = doc.create_element_ns ("http://live.gnome.org/GXml","gxml:code");
@@ -401,7 +401,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+XMLDOC);
#endif
- var doc = new GDocument.from_string (XMLDOC) as DomDocument;
+ var doc = new XDocument.from_string (XMLDOC) as DomDocument;
assert (doc.url == "about:blank");
assert (doc.document_uri == "about:blank");
assert (doc.origin == "");
@@ -442,7 +442,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
assert (lec4.length == 0);
var lec5 = doc.get_elements_by_class_name ("node parent");
#if DEBUG
- GLib.message ("Doc in use:\n"+(doc as GDocument).libxml_to_string ());
+ GLib.message ("Doc in use:\n"+(doc as XDocument).libxml_to_string ());
GLib.message ("Class node found: "+lec5.length.to_string ());
#endif
assert (lec5.length == 3);
@@ -476,8 +476,8 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+XMLDOC);
#endif
- var doc = new GDocument.from_string (XMLDOC) as DomDocument;
- var doc2 = new GDocument.from_string (STRDOC) as DomDocument;
+ var doc = new XDocument.from_string (XMLDOC) as DomDocument;
+ var doc2 = new XDocument.from_string (STRDOC) as DomDocument;
doc.import_node (doc2.document_element, false);
#if DEBUG
GLib.message ("DOC: "+(doc.document_element as GXml.Node).to_string ());
@@ -496,8 +496,8 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
#if DEBUG
GLib.message ("Doc: "+XMLDOC);
#endif
- var doc = new GDocument.from_string (XMLDOC) as DomDocument;
- var doc2 = new GDocument.from_string (STRDOC) as DomDocument;
+ var doc = new XDocument.from_string (XMLDOC) as DomDocument;
+ var doc2 = new XDocument.from_string (STRDOC) as DomDocument;
doc2.adopt_node (doc.document_element.children.last ());
#if DEBUG
GLib.message ("DOC: "+(doc.document_element as GXml.Node).to_string ());
@@ -526,7 +526,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
});
Test.add_func ("/gxml/dom/character", () => {
try {
- var d = new GDocument () as DomDocument;
+ var d = new XDocument () as DomDocument;
var t = d.create_text_node ("TEXT") as DomCharacterData;
assert (t.data == "TEXT");
assert (t.length == "TEXT".length);
diff --git a/test/GHtmlDocumentTest.vala b/test/GHtmlDocumentTest.vala
index 9887e5a..ef12576 100644
--- a/test/GHtmlDocumentTest.vala
+++ b/test/GHtmlDocumentTest.vala
@@ -1510,7 +1510,7 @@ var _analytics_elem = document.getElementsByTagName('script')[0]; _analytics_ele
""";
DomDocument doc;
doc = new GHtmlDocument.from_string (src);
- message ((doc as GDocument).to_string ());
+ message ((doc as XDocument).to_string ());
assert (doc.document_element != null);
var c = doc.document_element.get_elements_by_property_value ("property",
"article:published_time");
foreach (DomNode n in c) {
diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala
index 42c565e..8d8da76 100644
--- a/test/GXmlTest.vala
+++ b/test/GXmlTest.vala
@@ -32,7 +32,7 @@ class GXmlTest {
ValaLibxml2Test.add_tests ();
GElementTest.add_tests ();
GHtmlDocumentTest.add_tests ();
- DomGDocumentTest.add_tests ();
+ DomXDocumentTest.add_tests ();
XPathTest.add_tests ();
GomDocumentTest.add_tests ();
GomElementTest.add_tests ();
diff --git a/test/GElementTest.vala b/test/XElementTest.vala
similarity index 96%
rename from test/GElementTest.vala
rename to test/XElementTest.vala
index f6c64c2..23b1f1b 100644
--- a/test/GElementTest.vala
+++ b/test/XElementTest.vala
@@ -26,7 +26,7 @@ class GElementTest : GXmlTest {
public static void add_tests () {
Test.add_func ("/gxml/gelement/to_string", () =>{
try {
- DomDocument doc = new GDocument.from_string ("<root />");
+ DomDocument doc = new XDocument.from_string ("<root />");
var elem = doc.create_element ("country");
var t = doc.create_text_node ("New Zealand");
assert (t != null);
@@ -45,7 +45,7 @@ class GElementTest : GXmlTest {
});
Test.add_func ("/gxml/gelement/previous_element_sibling", () => {
try {
- var doc = new GDocument.from_string ("<root> <child/> <child/></root>");
+ var doc = new XDocument.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);
@@ -76,7 +76,7 @@ class GElementTest : GXmlTest {
});
Test.add_func ("/gxml/gelement/css-selector", () => {
try {
- var d = new GDocument () as DomDocument;
+ var d = new XDocument () as DomDocument;
var r = d.create_element ("root");
d.append_child (r);
var c1 = d.create_element ("child");
@@ -134,7 +134,7 @@ class GElementTest : GXmlTest {
});
Test.add_func ("/gxml/g-document/dom-write-read", () => {
try {
- DomDocument d = new GDocument ();
+ DomDocument d = new XDocument ();
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/XPathTest.vala b/test/XPathTest.vala
index 8c6633a..08fee71 100644
--- a/test/XPathTest.vala
+++ b/test/XPathTest.vala
@@ -33,9 +33,9 @@ class XPathTest : GXmlTest {
DomDocument document = null;
var rf = GLib.File.new_for_uri ("http://www.w3schools.com/xsl/books.xml");
if (rf.query_exists ()) {
- document = new GDocument.from_uri ("http://www.w3schools.com/xsl/books.xml");
+ document = new XDocument.from_uri ("http://www.w3schools.com/xsl/books.xml");
} else
- document = new GDocument.from_string (BOOKS);
+ document = new XDocument.from_string (BOOKS);
assert (document != null);
var object = (document as GXml.XPathContext).evaluate ("/bookstore/book/title");
assert (object.object_type == XPathObjectType.NODESET);
diff --git a/test/meson.build b/test/meson.build
index 2986fe1..e0fbe18 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -7,14 +7,14 @@ files_tests = files ([
'GXmlTest.vala',
'CssSelectorTest.vala',
'ValaLibxml2Test.vala',
- 'GElementTest.vala',
'GHtmlDocumentTest.vala',
- 'DomGDocumentTest.vala',
- 'XPathTest.vala',
+ 'DomXDocumentTest.vala',
'GomDocumentTest.vala',
'GomElementTest.vala',
'GomSerializationTest.vala',
- 'GomSchemaTest.vala'
+ 'GomSchemaTest.vala',
+ 'XElementTest.vala',
+ 'XPathTest.vala',
])
tests_cargs = []
@@ -69,7 +69,7 @@ benchmark ('gom-performance-iterate', gom_performance_iterate)
files_libxml_performance = files ([
- 'GXmlDocumentPerformanceTest.vala'
+ 'DocumentPerformanceTest.vala'
])
libxml_performance = executable('libxml-performance-load', files_libxml_performance + configvapi +
configtestvapi,
vala_args : [],
@@ -80,7 +80,7 @@ libxml_performance = executable('libxml-performance-load', files_libxml_performa
benchmark ('libxml-performance-load', libxml_performance)
files_libxml_performance_iterate = files ([
- 'GXmlDocumentPerformanceIterateTest.vala'
+ 'DocumentPerformanceIterateTest.vala'
])
libxml_performance_iterate = executable('libxml-performance-iterate', files_gom_performance + configvapi +
configtestvapi,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]