[gxml] Added interfaces for DOM 4 support
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Added interfaces for DOM 4 support
- Date: Tue, 3 May 2016 23:51:05 +0000 (UTC)
commit 6d92a3cf641c2a942fc299134de26e6d8ef05019
Author: Daniel Espinosa <esodan gmail com>
Date: Tue May 3 18:50:37 2016 -0500
Added interfaces for DOM 4 support
gxml/DomAttr.vala | 31 +++++++++
gxml/DomCharacter.vala | 46 ++++++++++++++
gxml/DomCollections.vala | 73 +++++++++++++++++++++
gxml/DomDocument.vala | 76 ++++++++++++++++++++++
gxml/DomElement.vala | 48 ++++++++++++++
gxml/DomEvents.vala | 91 +++++++++++++++++++++++++++
gxml/DomMutationObservers.vala | 56 +++++++++++++++++
gxml/DomNode.vala | 135 ++++++++++++++++++++++++++++++++++++++++
gxml/DomRange.vala | 62 ++++++++++++++++++
gxml/DomSets.vala | 43 +++++++++++++
gxml/DomTraversal.vala | 73 +++++++++++++++++++++
gxml/Makefile.am | 14 ++++-
12 files changed, 747 insertions(+), 1 deletions(-)
---
diff --git a/gxml/DomAttr.vala b/gxml/DomAttr.vala
new file mode 100644
index 0000000..11dd838
--- /dev/null
+++ b/gxml/DomAttr.vala
@@ -0,0 +1,31 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomAttr {
+ public abstract string? namespaceURI { get; }
+ public abstract string? prefix { get; }
+ public abstract string localName { get; }
+ public abstract string name { get; }
+ public abstract string value { get; set; }
+
+ public abstract bool specified { get; } // useless; always returns true
+}
diff --git a/gxml/DomCharacter.vala b/gxml/DomCharacter.vala
new file mode 100644
index 0000000..69fc2f1
--- /dev/null
+++ b/gxml/DomCharacter.vala
@@ -0,0 +1,46 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomCharacterData : GLib.Object, GXml.DomNode, GXml.DomNonDocumentTypeChildNode,
GXml.DomChildNode {
+ /**
+ * Null is an empty string.
+ */
+ public abstract string data { get; set; }
+ public abstract ulong length { get; }
+ public abstract string substringData(ulong offset, ulong count);
+ public abstract void appendData(string data);
+ public abstract void insertData(ulong offset, string data);
+ public abstract void deleteData(ulong offset, ulong count);
+ public abstract void replaceData(ulong offset, ulong count, string data);
+}
+
+public interface GXml.DomText : GXml.DomCharacterData {
+ public abstract GXml.DomText splitText(ulong offset);
+ public abstract string wholeText { get; }
+}
+
+public interface GXml.DomProcessingInstruction : GXml.DomCharacterData {
+ public abstract string target { get; }
+}
+
+public interface GXml.DomComment : GXml.DomCharacterData {}
+
diff --git a/gxml/DomCollections.vala b/gxml/DomCollections.vala
new file mode 100644
index 0000000..e7243c9
--- /dev/null
+++ b/gxml/DomCollections.vala
@@ -0,0 +1,73 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+
+public interface GXml.DomNonElementParentNode : GLib.Object {
+ public abstract DomElement? getElementById(string elementId);
+}
+
+public interface GXml.DomParentNode : GLib.Object {
+ public abstract DomHTMLCollection children { get; }
+ public abstract DomElement? firstElementChild { get; }
+ public abstract DomElement? lastElementChild { get; }
+ public abstract ulong childElementCount { get; }
+
+ public abstract DomElement? querySelector(string selectors);
+ public abstract DomNodeList querySelectorAll(string selectors);
+}
+
+public interface GXml.DomNonDocumentTypeChildNode : GLib.Object {
+ public abstract DomElement? previousElementSibling { get; }
+ public abstract DomElement? nextElementSibling { get; }
+}
+
+public interface GXml.DomChildNode : GLib.Object {
+ public abstract void remove();
+}
+
+
+public interface GXml.DomNodeList : GLib.Object, Gee.BidirList<GXml.DomNode> {
+ public abstract DomNode? item (ulong index);
+ public abstract ulong length { get; }
+}
+
+public interface GXml.DomHTMLCollection : GLib.Object, Gee.BidirList<GXml.DomNode> {
+ public abstract ulong length { get; }
+ public abstract DomElement? item (ulong index);
+ public abstract DomElement? namedItem (string name);
+}
+
+public interface GXml.DomNamedNodeMap : GLib.Object {
+ public abstract DomNode getNamedItem(string name);
+ public abstract DomNode setNamedItem(DomNode arg) throws GXml.DomError;
+ public abstract DomNode removeNamedItem(string name) throws GXml.DomError;
+ public abstract DomNode item (ulong index);
+ public abstract ulong length { get; }
+ // Introduced in DOM Level 2:
+ public abstract DomNode getNamedItemNS(string namespaceURI, string localName) throws GXml.DomError;
+ // Introduced in DOM Level 2:
+ public abstract DomNode setNamedItemNS(DomNode arg) throws GXml.DomError;
+ // Introduced in DOM Level 2:
+ public abstract DomNode removeNamedItemNS(string namespaceURI, string localName) throws GXml.DomError;
+}
+
+
diff --git a/gxml/DomDocument.vala b/gxml/DomDocument.vala
new file mode 100644
index 0000000..24c050c
--- /dev/null
+++ b/gxml/DomDocument.vala
@@ -0,0 +1,76 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomDocument : GLib.Object, GXml.DomNode, GXml.DomParentNode,
GXml.DomNonElementParentNode {
+ public abstract DomImplementation implementation { get; }
+ public abstract string URL { get; }
+ public abstract string documentURI { get; }
+ public abstract string origin { get; }
+ public abstract string compatMode { get; }
+ public abstract string characterSet { get; }
+ public abstract string contentType { get; }
+
+ public abstract DomDocumentType? doctype { get; }
+ public abstract DomElement? documentElement { get; }
+
+ public abstract DomHTMLCollection getElementsByTagName(string localName);
+ public abstract DomHTMLCollection getElementsByTagNameNS(string? namespace, string localName);
+ public abstract DomHTMLCollection getElementsByClassName(string classNames);
+
+ public abstract DomElement createElement(string localName);
+ public abstract DomElement createElementNS(string? namespace, string qualifiedName);
+ public abstract DomDocumentFragment createDocumentFragment();
+ public abstract DomText createTextNode(string data);
+ public abstract DomComment createComment(string data);
+ public abstract DomProcessingInstruction createProcessingInstruction(string target, string data);
+
+ public abstract DomNode importNode(DomNode node, bool deep = false);
+ public abstract DomNode adoptNode(DomNode node);
+
+ public abstract DomEvent createEvent(string interface);
+
+ public abstract DomRange createRange();
+
+ // NodeFilter.SHOW_ALL = 0xFFFFFFFF
+ public abstract DomNodeIterator createNodeIterator(DomNode root, ulong whatToShow = (ulong) 0xFFFFFFFF,
DomNodeFilter? filter = null);
+ public abstract DomTreeWalker createTreeWalker(DomNode root, ulong whatToShow = (ulong) 0xFFFFFFFF,
DomNodeFilter? filter = null);
+}
+
+public interface GXml.DomXMLDocument : GLib.Object, GXml.DomDocument {}
+
+public interface GXml.DomImplementation : GLib.Object {
+ public abstract DomDocumentType createDocumentType(string qualifiedName, string publicId, string systemId);
+ public abstract DomXMLDocument createDocument(string? namespace, string? qualifiedName, DocumentType?
doctype = null);
+ public abstract Document createHTMLDocument(string title);
+
+ public abstract bool hasFeature(); // useless; always returns true
+}
+
+public interface GXml.DomDocumentFragment : GLib.Object, GXml.DomNode, GXml.DomParentNode,
GXml.DomNonElementParentNode {}
+
+public interface GXml.DomDocumentType : GLib.Object, GXml.DomNode, GXml.DomChildNode {
+ public abstract string name { get; }
+ public abstract string publicId { get; }
+ public abstract string systemId { get; }
+}
+
+
diff --git a/gxml/DomElement.vala b/gxml/DomElement.vala
new file mode 100644
index 0000000..3c1b699
--- /dev/null
+++ b/gxml/DomElement.vala
@@ -0,0 +1,48 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomElement : GLib.Object, GXml.DomNode, GXml.DomParentNode,
GXml.DomNonDocumentTypeChildNode, GXml.DomChildNode {
+ public abstract string? namespaceURI { get; }
+ public abstract string? prefix { get; }
+ public abstract string localName { get; }
+ public abstract string tagName { get; }
+
+ public abstract string id { get; set; }
+ public abstract string className { get; set; }
+ public abstract DomTokenList classList { get; }
+
+ public abstract DomNamedNodeMap attributes { get; }
+ public abstract string? getAttribute(string name);
+ public abstract string? getAttributeNS(string? namespace, string localName);
+ public abstract void setAttribute(string name, string value);
+ public abstract void setAttributeNS(string? namespace, string name, string value);
+ public abstract void removeAttribute(string name);
+ public abstract void removeAttributeNS(string? namespace, string localName);
+ public abstract bool hasAttribute(string name);
+ public abstract bool hasAttributeNS(string? namespace, string localName);
+
+
+ public abstract DomHTMLCollection getElementsByTagName(string localName);
+ public abstract DomHTMLCollection getElementsByTagNameNS(string? namespace, string localName);
+ public abstract DomHTMLCollection getElementsByClassName(string classNames);
+}
+
diff --git a/gxml/DomEvents.vala b/gxml/DomEvents.vala
new file mode 100644
index 0000000..a2ab81f
--- /dev/null
+++ b/gxml/DomEvents.vala
@@ -0,0 +1,91 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomEventTarget : GLib.Object {
+ public abstract void addEventListener(string type, DomEventListener? callback, bool capture = false);
+ public abstract void removeEventListener(string type, DomEventListener? callback, bool capture = false);
+ public abstract bool dispatchEvent(DomEvent event);
+}
+
+public interface GXml.DomEventListener : GLib.Object {
+ public abstract void handleEvent(DomEvent event);
+}
+
+public interface GXml.DomEvent : GLib.Object {
+ public abstract string etype { get; }
+ public abstract DomEventTarget? target { get; }
+ public abstract DomEventTarget? currentTarget { get; }
+ public abstract bool bubbles { get; }
+ public abstract bool cancelable { get; }
+
+ public const ushort NONE = 0;
+ public const ushort CAPTURING_PHASE = 1;
+ public const ushort AT_TARGET = 2;
+ public const ushort BUBBLING_PHASE = 3;
+ public abstract ushort eventPhase { get; }
+
+
+ public abstract void stopPropagation();
+ public abstract void stopImmediatePropagation();
+
+ public abstract void preventDefault();
+ public abstract bool defaultPrevented { get; }
+
+ public abstract bool isTrusted { get; }
+ public abstract DomTimeStamp timeStamp { get; }
+
+ public abstract void initEvent(string type, bool bubbles, bool cancelable);
+
+ [Flags]
+ public enum Flags {
+ STOP_PROPAGATION_FLAG,
+ STOP_IMMEDIATE_PROPAGATION_FLAG,
+ CANCELED_FLAG,
+ INITIALIZED_FLAG,
+ DISPATCH_FLAG
+ }
+}
+
+public class GXml.DomEventInit : GLib.Object {
+ public bool bubbles { get; set; default = false; }
+ public bool cancelable { get; set; default = false; }
+}
+
+public interface GXml.DomCustomEvent : GLib.Object, GXml.DomEvent {
+ public abstract GLib.Value? detail { get; }
+
+ public abstract void initCustomEvent (string type, bool bubbles, bool cancelable, GLib.Value? detail);
+}
+
+public class GXml.DomCustomEventInit : GXml.DomEventInit {
+ public GLib.Value? detail { get; set; default = null; }
+}
+
+
+public class GXml.DomTimeStamp : GLib.Object {
+ public GLib.DateTime time { get; set; }
+ public string to_string () {
+ return time.format ("%y-%m-%dT%T");
+ }
+}
+
+
diff --git a/gxml/DomMutationObservers.vala b/gxml/DomMutationObservers.vala
new file mode 100644
index 0000000..093775b
--- /dev/null
+++ b/gxml/DomMutationObservers.vala
@@ -0,0 +1,56 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+using Gee;
+
+/**
+ * Implementators should use constructor with one argument { link GXml.DomMutationCallback}
+ * to use internally.
+ */
+public interface GXml.DomMutationObserver : GLib.Object {
+ public abstract void observe(Node target, DomMutationObserverInit options);
+ public abstract void disconnect();
+ public abstract Gee.List<DomMutationRecord> takeRecords();
+}
+
+public delegate void GXml.DomMutationCallback (Gee.List<DomMutationRecord> mutations, DomMutationObserver
observer);
+
+public class GXml.DomMutationObserverInit : GLib.Object {
+ public bool childList { get; set; default = false; }
+ public bool attributes { get; set; }
+ public bool characterData { get; set; }
+ public bool subtree { get; set; default = false; }
+ public bool attributeOldValue { get; set; }
+ public bool characterDataOldValue { get; set; }
+ public Gee.List<string> attributeFilter { get; set; }
+}
+
+public interface GXml.DomMutationRecord : GLib.Object {
+ public abstract string mtype { get; }
+ public abstract DomNode target { get; }
+ public abstract DomNodeList addedNodes { get; set; }
+ public abstract DomNodeList removedNodes { get; set; }
+ public abstract DomNode? previousSibling { get; }
+ public abstract DomNode? nextSibling { get; }
+ public abstract string? attributeName { get; }
+ public abstract string? attributeNamespace { get; }
+ public abstract string? oldValue { get; }
+}
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
new file mode 100644
index 0000000..50fbe29
--- /dev/null
+++ b/gxml/DomNode.vala
@@ -0,0 +1,135 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomNode : GLib.Object, GXml.DomEventTarget {
+ public const ushort ELEMENT_NODE = 1;
+ public const ushort ATTRIBUTE_NODE = 2; // historical
+ public const ushort TEXT_NODE = 3;
+ public const ushort CDATA_SECTION_NODE = 4; // historical
+ public const ushort ENTITY_REFERENCE_NODE = 5; // historical
+ public const ushort ENTITY_NODE = 6; // historical
+ public const ushort PROCESSING_INSTRUCTION_NODE = 7;
+ public const ushort COMMENT_NODE = 8;
+ public const ushort DOCUMENT_NODE = 9;
+ public const ushort DOCUMENT_TYPE_NODE = 10;
+ public const ushort DOCUMENT_FRAGMENT_NODE = 11;
+ public const ushort NOTATION_NODE = 12; // historical
+ public abstract ushort nodeType { get; }
+ public abstract string nodeName { get; }
+
+ public abstract string? baseURI { get; }
+
+ public abstract Document? ownerDocument { get; }
+ public abstract DomNode? parentNode { get; }
+ public abstract DomElement? parentElement { get; }
+ public abstract DomNodeList childNodes { get; }
+ public abstract DomNode? firstChild { get; }
+ public abstract DomNode? lastChild { get; }
+ public abstract DomNode? previousSibling { get; }
+ public abstract DomNode? nextSibling { get; }
+
+ public abstract string? nodeValue { get; set; }
+ public abstract string? textContent { get; set; }
+
+ public abstract bool hasChildNodes();
+ public abstract void normalize();
+
+ public abstract DomNode cloneNode(bool deep = false);
+ public abstract bool isEqualNode(DomNode? node);
+
+ public const ushort DOCUMENT_POSITION_DISCONNECTED = 0x01;
+ public const ushort DOCUMENT_POSITION_PRECEDING = 0x02;
+ public const ushort DOCUMENT_POSITION_FOLLOWING = 0x04;
+ public const ushort DOCUMENT_POSITION_CONTAINS = 0x08;
+ public const ushort DOCUMENT_POSITION_CONTAINED_BY = 0x10;
+ public const ushort DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
+ public abstract ushort compareDocumentPosition(DomNode other);
+ public abstract bool contains(DomNode? other);
+
+ public abstract string? lookupPrefix(string? namespace);
+ public abstract string? lookupNamespaceURI(string? prefix);
+ public abstract bool isDefaultNamespace(string? namespace);
+
+ public abstract DomNode insertBefore(DomNode node, DomNode? child);
+ public abstract DomNode appendChild(DomNode node);
+ public abstract DomNode replaceChild(DomNode node, DomNode child);
+ public abstract DomNode removeChild(DomNode child);
+}
+
+public errordomain GXml.DomError {
+ INDEX_SIZE_ERROR,
+ HIERARCHY_REQUEST_ERROR,
+ WRONG_DOCUMENT_ERROR,
+ INVALID_CHARACTER_ERROR,
+ NO_MODIFICATION_ALLOWED_ERROR,
+ NOT_FOUND_ERROR,
+ NOT_SUPPORTED_ERROR,
+ INVALID_STATE_ERROR,
+ SYNTAX_ERROR,
+ INVALID_MODIFICATION_ERROR,
+ NAMESPACE_ERROR,
+ INVALID_ACCESS_ERROR,
+ SECURITY_ERROR,
+ NETWORK_ERROR,
+ ABORT_ERROR,
+ URL_MISMATCH_ERROR,
+ QUOTA_EXCEEDED_ERROR,
+ TIMEOUT_ERROR,
+ INVALID_NODE_TYPE_ERROR,
+ DATA_CLONE_ERROR,
+ ENCODING_ERROR,
+ NOT_READABLE_ERROR
+}
+
+public class GXml.DomErrorName : GLib.Object {
+ private string[] names = new string [30];
+ construct {
+ names += "IndexSizeError";
+ names += "HierarchyRequestError";
+ names += "WrongDocumentError";
+ names += "InvalidCharacterError";
+ names += "NoModificationAllowedError";
+ names += "NotFoundError";
+ names += "NotSupportedError";
+ names += "InvalidStateError";
+ names += "SyntaxError";
+ names += "InvalidModificationError";
+ names += "NamespaceError";
+ names += "InvalidAccessError";
+ names += "SecurityError";
+ names += "NetworkError";
+ names += "AbortError";
+ names += "URLMismatchError";
+ names += "QuotaExceededError";
+ names += "TimeoutError";
+ names += "InvalidNodeTypeError";
+ names += "DataCloneError";
+ names += "EncodingError";
+ names += "NotReadableError";
+ }
+ public string get_name (int error_code) {
+ return names[error_code];
+ }
+}
+
+
+
diff --git a/gxml/DomRange.vala b/gxml/DomRange.vala
new file mode 100644
index 0000000..3a5931f
--- /dev/null
+++ b/gxml/DomRange.vala
@@ -0,0 +1,62 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomRange {
+ public abstract DomNode startContainer { get; }
+ public abstract ulong startOffset { get; }
+ public abstract DomNode endContainer { get; }
+ public abstract ulong endOffset { get; }
+ public abstract bool collapsed { get; }
+ public abstract DomNode commonAncestorContainer { get; }
+
+ public abstract void setStart(DomNode node, ulong offset);
+ public abstract void setEnd(DomNode node, ulong offset);
+ public abstract void setStartBefore(DomNode node);
+ public abstract void setStartAfter(DomNode node);
+ public abstract void setEndBefore(DomNode node);
+ public abstract void setEndAfter(DomNode node);
+ public abstract void collapse(bool toStart = false);
+ public abstract void selectNode(DomNode node);
+ public abstract void selectNodeContents(DomNode node);
+
+ public const ushort START_TO_START = 0;
+ public const ushort START_TO_END = 1;
+ public const ushort END_TO_END = 2;
+ public const ushort END_TO_START = 3;
+ public abstract short compareBoundaryPoints(ushort how, DomRange sourceRange);
+
+ public abstract void deleteContents();
+ public abstract DomDocumentFragment extractContents();
+ public abstract DomDocumentFragment cloneContents();
+ public abstract void insertNode(DomNode node);
+ public abstract void surroundContents(DomNode newParent);
+
+ public abstract DomRange cloneRange();
+ public abstract void detach();
+
+ public abstract bool isPointInRange(DomNode node, ulong offset);
+ public abstract short comparePoint(DomNode node, ulong offset);
+
+ public abstract bool intersectsNode(DomNode node);
+
+ public abstract string to_string ();
+}
diff --git a/gxml/DomSets.vala b/gxml/DomSets.vala
new file mode 100644
index 0000000..3e6d935
--- /dev/null
+++ b/gxml/DomSets.vala
@@ -0,0 +1,43 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+public interface GXml.DomTokenList : GLib.Object, Gee.BidirList<string> {
+ public abstract ulong length { get; }
+ public abstract string? item(ulong index);
+ public abstract bool contains(string token);
+ public abstract void add(string[] tokens);
+ public abstract void remove(string[] tokens);
+ /**
+ * If @auto is true, adds @token if not present and removing if it, no @force value
+ * is taken in account. If @auto is false, then @force is considered; if true adds
+ * @token, if false removes it.
+ */
+ public abstract bool toggle(string token, bool force = false, bool auto = true);
+ public abstract string to_string ();
+}
+
+public interface GXml.DomSettableTokenList : GXml.DomTokenList {
+ public abstract string value { get; set; }
+}
+
diff --git a/gxml/DomTraversal.vala b/gxml/DomTraversal.vala
new file mode 100644
index 0000000..1949833
--- /dev/null
+++ b/gxml/DomTraversal.vala
@@ -0,0 +1,73 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+public interface GXml.DomNodeIterator : GLib.Object {
+ public abstract DomNode root { get; }
+ public abstract DomNode referenceNode { get; }
+ public abstract bool pointerBeforeReferenceNode { get; }
+ public abstract ulong whatToShow { get; }
+ public abstract DomNodeFilter? filter { get; }
+
+ public abstract DomNode? nextNode();
+ public abstract DomNode? previousNode();
+
+ public abstract void detach();
+}
+
+public interface GXml.DomTreeWalker {
+ public abstract DomNode root { get; }
+ public abstract ulong whatToShow { get; }
+ public abstract DomNodeFilter? filter { get; }
+ public abstract DomNode currentNode { get; set; }
+
+ public abstract DomNode? parentNode();
+ public abstract DomNode? firstChild();
+ public abstract DomNode? lastChild();
+ public abstract DomNode? previousSibling();
+ public abstract DomNode? nextSibling();
+ public abstract DomNode? previousNode();
+ public abstract DomNode? nextNode();
+}
+
+public interface GXml.DomNodeFilter : GLib.Object {
+ // Constants for acceptNode()
+ public const ushort FILTER_ACCEPT = 1;
+ public const ushort FILTER_REJECT = 2;
+ public const ushort FILTER_SKIP = 3;
+
+ // Constants for whatToShow
+ public const ulong SHOW_ALL = (ulong) 0xFFFFFFFF;
+ public const ulong SHOW_ELEMENT = 0x1;
+ public const ulong SHOW_ATTRIBUTE = 0x2; // historical
+ public const ulong SHOW_TEXT = 0x4;
+ public const ulong SHOW_CDATA_SECTION = 0x8; // historical
+ public const ulong SHOW_ENTITY_REFERENCE = 0x10; // historical
+ public const ulong SHOW_ENTITY = 0x20; // historical
+ public const ulong SHOW_PROCESSING_INSTRUCTION = 0x40;
+ public const ulong SHOW_COMMENT = 0x80;
+ public const ulong SHOW_DOCUMENT = 0x100;
+ public const ulong SHOW_DOCUMENT_TYPE = 0x200;
+ public const ulong SHOW_DOCUMENT_FRAGMENT = 0x400;
+ public const ulong SHOW_NOTATION = 0x800; // historical
+
+ public abstract ushort acceptNode(Node node);
+}
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index e29f08a..bad2df4 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -93,7 +93,19 @@ sources = \
GXmlText.vala \
GXmlHashMapAttr.vala \
GXmlListChildren.vala \
- GXmlListNamespaces.vala
+ GXmlListNamespaces.vala \
+ DomAttr.vala \
+ DomCharacter.vala \
+ DomCollections.vala \
+ DomDocument.vala \
+ DomElement.vala \
+ DomEvents.vala \
+ DomMutationObservers.vala \
+ DomNode.vala \
+ DomRange.vala \
+ DomSets.vala \
+ DomTraversal.vala
+
### General Compilation flags
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]