diff --git a/gxml/Document.vala b/gxml/Document.vala index b3c9f2a68baf6ec96606327a1ac2e549dc621575..651515eb5816d03dc5e2ec2d9bd1e06dcfd0d149 100644 --- a/gxml/Document.vala +++ b/gxml/Document.vala @@ -100,7 +100,7 @@ public class GXml.Document : GXml.Node, parser.read_file (file); } - private GomElement get_root_gom_element () { + private GXml.Element get_root_gom_element () { Object obj = null; foreach (ParamSpec spec in this.get_class ().list_properties ()) { if ("::" in spec.get_nick ()) { @@ -108,13 +108,13 @@ public class GXml.Document : GXml.Node, if (name != "root") { continue; } - if (spec.value_type.is_a (typeof (GomElement))) { + if (spec.value_type.is_a (typeof (GXml.Element))) { Value val = Value (Type.OBJECT); get_property (spec.name, ref val); - obj = val.get_object () as GomElement; + obj = val.get_object () as GXml.Element; if (obj == null) { obj = Object.new (spec.value_type,"owner-document", this.owner_document); - try { this.append_child (obj as GomElement); } + try { this.append_child (obj as GXml.Element); } catch (GLib.Error e) { warning (_("Error while attempting to instantiate root property object: %s").printf (e.message)); obj = null; @@ -125,7 +125,7 @@ public class GXml.Document : GXml.Node, } } } - return obj as GomElement; + return obj as GXml.Element; } /** @@ -164,7 +164,7 @@ public class GXml.Document : GXml.Node, _parser = parser; } public DomElement create_element (string local_name) throws GLib.Error { - var e = new GomElement (); + var e = new GXml.Element (); e.initialize_document (this, local_name); return e; } @@ -192,7 +192,7 @@ public class GXml.Document : GXml.Node, && namespace_uri == "http://www.w3.org/2000/xmlns/") throw new DomError.NAMESPACE_ERROR (_("Only xmlns prefixs can be used with http://www.w3.org/2000/xmlns/")); - var e = new GomElement (); + var e = new GXml.Element (); e.initialize_document_with_namespace (this, namespace_uri, nsp, n); return e; } diff --git a/gxml/GomElement.vala b/gxml/Element.vala similarity index 96% rename from gxml/GomElement.vala rename to gxml/Element.vala index 05f31816b11e2aa7285312d3310342398345534e..5fad2db5a1337e2c72b63634a55136a66e2dc5e5 100644 --- a/gxml/GomElement.vala +++ b/gxml/Element.vala @@ -29,14 +29,14 @@ using Gee; * This object avoids pre and post XML parsing, by using a one step parsing * to translate text XML tree to an GObject based tree. * - * A GXml Object Model (GOM) implementation of {@link GomElement}.It can be used + * A GXml Object Model (GOM) implementation of {@link GXml.Element}.It can be used * transparently as {@link DomElement} in a XML tree. * * It also allows delayed parsing, so you can read large documents by parsing * just a XML element node and its attributes but not its childs; save its childs * as a text, for a post-on-step-parsing. */ -public class GXml.GomElement : GXml.Node, +public class GXml.Element : GXml.Node, DomChildNode, DomNonDocumentTypeChildNode, DomParentNode, @@ -49,7 +49,7 @@ public class GXml.GomElement : GXml.Node, protected Attributes _attributes; // Convenient Serialization methods /** - * Parses an XML file, deserializing it over {@link GomElement}. + * Parses an XML file, deserializing it over {@link GXml.Element}. */ public void read_from_file (GLib.File f, GLib.Cancellable? cancellable = null) throws GLib.Error { @@ -58,7 +58,7 @@ public class GXml.GomElement : GXml.Node, parser.read_file (f); } /** - * Parses asinchronically an XML file, deserializing it over {@link GomElement}. + * Parses asinchronically an XML file, deserializing it over {@link GXml.Element}. */ public async void read_from_file_async (GLib.File f, GLib.Cancellable? cancellable = null) throws GLib.Error { @@ -67,7 +67,7 @@ public class GXml.GomElement : GXml.Node, yield parser.read_file_async (f); } /** - * Parses an XML over a {@link GLib.InputStream}, deserializing it over {@link GomElement}. + * Parses an XML over a {@link GLib.InputStream}, deserializing it over {@link GXml.Element}. */ public void read_from_stream (GLib.InputStream istream, GLib.Cancellable? cancellable = null) throws GLib.Error { @@ -76,7 +76,7 @@ public class GXml.GomElement : GXml.Node, parser.read_stream (istream); } /** - * Parses asynchronically an XML over a {@link GLib.InputStream}, deserializing it over {@link GomElement}. + * Parses asynchronically an XML over a {@link GLib.InputStream}, deserializing it over {@link GXml.Element}. */ public async void read_from_stream_async (GLib.InputStream istream, GLib.Cancellable? cancellable = null) throws GLib.Error { @@ -85,7 +85,7 @@ public class GXml.GomElement : GXml.Node, yield parser.read_stream_async (istream); } /** - * Parses an XML string, deserializing it over {@link GomElement}. + * Parses an XML string, deserializing it over {@link GXml.Element}. */ public void read_from_string (string str, Cancellable? cancellable = null) throws GLib.Error { var parser = new XParser (this); @@ -93,7 +93,7 @@ public class GXml.GomElement : GXml.Node, parser.read_string (str); } /** - * Parses an XML string, deserializing it over {@link GomElement}. + * Parses an XML string, deserializing it over {@link GXml.Element}. */ public async void read_from_string_async (string str, Cancellable? cancellable = null) throws GLib.Error { var parser = new XParser (this); @@ -101,7 +101,7 @@ public class GXml.GomElement : GXml.Node, yield parser.read_string_async (str); } /** - * Serialize {@link GomElement} to a string. + * Serialize {@link GXml.Element} to a string. */ public string write_string (Cancellable? cancellable = null) throws GLib.Error { var parser = new XParser (this); @@ -109,7 +109,7 @@ public class GXml.GomElement : GXml.Node, return parser.write_string (); } /** - * Serialize asinchronically {@link GomElement} to a string. + * Serialize asinchronically {@link GXml.Element} to a string. */ public async string write_string_async (Cancellable? cancellable = null) throws GLib.Error { var parser = new XParser (this); @@ -142,14 +142,14 @@ public class GXml.GomElement : GXml.Node, } /** * Creates an {@link GLib.InputStream} to write a string representation - * in XML of {@link GomElement} using node's {@link GXml.Document} + * in XML of {@link GXml.Element} using node's {@link GXml.Document} */ public InputStream create_stream () throws GLib.Error { 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 GXml.Document} + * in XML of {@link GXml.Element} using node's {@link GXml.Document} */ public async InputStream create_stream_async (Cancellable? cancellable = null) throws GLib.Error { return yield (this.owner_document as GXml.Document).create_stream_async (); @@ -293,7 +293,7 @@ public class GXml.GomElement : GXml.Node, * An attribute called 'class'. */ public string? class_name { - owned get { return (this as GomElement).get_attribute ("class"); } + owned get { return (this as GXml.Element).get_attribute ("class"); } set { (this as GomObject).set_attribute ("class", value); } } /** @@ -321,8 +321,8 @@ public class GXml.GomElement : GXml.Node, }); } /** - * Convenient function to initialize, at construction time, a {@link GomElement} - * using given local name. If {@link GomElement.initialize_with_namespace} + * Convenient function to initialize, at construction time, a {@link GXml.Element} + * using given local name. If {@link GXml.Element.initialize_with_namespace} * has been called in any base class, this method just change elment node's name * and keeps previous namespace and prefix. * @@ -330,14 +330,14 @@ public class GXml.GomElement : GXml.Node, * document, you can call {@link DomNode.owner_document} to set one if not set * already. * - * Any instance properties of type {@link GomElement} or {@link Collection} + * Any instance properties of type {@link GXml.Element} or {@link Collection} * should be initialized using {@link GomObject.set_instance_property} */ public void initialize (string local_name) { _local_name = local_name; } /** - * Convenient function to initialize, at construction time, a {@link GomElement} + * Convenient function to initialize, at construction time, a {@link GXml.Element} * using given local name and document. */ public void initialize_document (DomDocument doc, string local_name) { @@ -345,7 +345,7 @@ public class GXml.GomElement : GXml.Node, _local_name = local_name; } /** - * Convenient function to initialize, at construction time, a {@link GomElement} + * Convenient function to initialize, at construction time, a {@link GXml.Element} * using given local name and namespace. */ public void initialize_with_namespace (string? namespace_uri, @@ -355,7 +355,7 @@ public class GXml.GomElement : GXml.Node, _prefix = prefix; } /** - * Convenient function to initialize, at construction time, a {@link GomElement} + * Convenient function to initialize, at construction time, a {@link GXml.Element} * using given local name, document and namespace. */ public void initialize_document_with_namespace (DomDocument doc, string? namespace_uri, @@ -373,10 +373,10 @@ public class GXml.GomElement : GXml.Node, public class Attributes : HashMap, DomNamedNodeMap { private TreeMap order = new TreeMap (); /** - * Holds {@link GomElement} refrence to attributes' parent element. + * Holds {@link GXml.Element} refrence to attributes' parent element. * Derived classes should not modify, but set at construction time. */ - protected GomElement _element; + protected GXml.Element _element; // DomNamedNodeMap public int length { get { return size; } } @@ -394,7 +394,7 @@ public class GXml.GomElement : GXml.Node, return null; } - public Attributes (GomElement element) { + public Attributes (GXml.Element element) { _element = element; } diff --git a/gxml/GomBaseCollection.vala b/gxml/GomBaseCollection.vala index f5557bafe4e87ba5e28c29a8fa23bc8ddd4368b7..1194c81419bf5f714fd34e75a66cbcc8cfff4daf 100644 --- a/gxml/GomBaseCollection.vala +++ b/gxml/GomBaseCollection.vala @@ -39,21 +39,21 @@ public abstract class GXml.BaseCollection : Object, Traversable, Ite * Element used to refer of containier element. You should define it at construction time * our set it as a construction property. */ - protected GomElement _element; + protected GXml.Element _element; /** * Local name of {@link DomElement} objects of {@link element}, which could be * contained in this collection. * * Used when reading to add elements to collection. You can set it at construction time, * by, for example, instantaiting a object of the type {@link Collection.items_type} - * then use {@link GomElement.local_name}'s value. + * then use {@link GXml.Element.local_name}'s value. */ protected string _items_name = ""; /** * Objects' type to be referenced by this collection and to deserialize objects. * Derived classes, can initilize this value at constructor or as construct property. * - * Used when reading and at initialization time, to know {@link GomElement.local_name} + * Used when reading and at initialization time, to know {@link GXml.Element.local_name} * at runtime. */ protected GLib.Type _items_type = GLib.Type.INVALID; @@ -77,19 +77,19 @@ public abstract class GXml.BaseCollection : Object, Traversable, Ite public DomElement element { get { return _element as DomElement; } construct set { - if (value is GomElement) - _element = value as GomElement; + if (value is GXml.Element) + _element = value as GXml.Element; } } /** * {@inheritDoc} */ public void initialize (GLib.Type items_type) throws GLib.Error { - if (!items_type.is_a (typeof (GomElement))) { + if (!items_type.is_a (typeof (GXml.Element))) { throw new DomError.INVALID_NODE_TYPE_ERROR - (_("Invalid attempt to initialize a collection using an unsupported type. Only GXmlGomElement is supported")); + (_("Invalid attempt to initialize a collection using an unsupported type. Only GXmlGXml.Element is supported")); } - var o = Object.new (items_type) as GomElement; + var o = Object.new (items_type) as GXml.Element; _items_name = o.local_name; _items_type = items_type; } @@ -99,10 +99,10 @@ public abstract class GXml.BaseCollection : Object, Traversable, Ite * with {@link Collection.items_type}, using its * {@link DomElement.local_name} to find it. * - * Implemenation classes, should initialize collection to hold a {@link GomElement} + * Implemenation classes, should initialize collection to hold a {@link GXml.Element} * derived type using {@link Collection.initialize}. */ - public void initialize_element (GomElement e) throws GLib.Error { + public void initialize_element (GXml.Element e) throws GLib.Error { _element = e; } @@ -117,9 +117,9 @@ public abstract class GXml.BaseCollection : Object, Traversable, Ite if (_element == null) throw new DomError.INVALID_NODE_TYPE_ERROR (_("Parent Element is invalid")); - if (!(node is GomElement)) + if (!(node is GXml.Element)) throw new DomError.INVALID_NODE_TYPE_ERROR - (_("Invalid attempt to set unsupported type. Only GXmlGomElement is supported")); + (_("Invalid attempt to set unsupported type. Only GXmlGXml.Element is supported")); if (node.owner_document != _element.owner_document) throw new DomError.HIERARCHY_REQUEST_ERROR (_("Invalid attempt to set a node with a different parent document")); @@ -133,8 +133,8 @@ public abstract class GXml.BaseCollection : Object, Traversable, Ite _nodes_index.push_tail (index); } /** - * Search for all child nodes in {@link element} of type {@link GomElement} - * with a {@link GomElement.local_name} equal to {@link Collection.items_name}, + * Search for all child nodes in {@link element} of type {@link GXml.Element} + * with a {@link GXml.Element.local_name} equal to {@link Collection.items_name}, * to add it to collection. This method calls {@link clear} first. * * Implementations could add additional restrictions to add element to collection. diff --git a/gxml/GomHashMap.vala b/gxml/GomHashMap.vala index 6da2a4c884d0f9b1b7ccd708281320e0711d9cb1..1a73301b8fa4a03a07f3965e15289d08620b458f 100644 --- a/gxml/GomHashMap.vala +++ b/gxml/GomHashMap.vala @@ -30,13 +30,13 @@ using Gee; * by items to be added. If key is not defined in node, it is not added; but * keeps it as a child node of actual {@link Collection.element}. * - * If {@link GomElement} to be added is of type {@link Collection.items_type} + * If {@link GXml.Element} to be added is of type {@link Collection.items_type} * and implements {@link MappeableElement}, you should set {@link GomHashMap.attribute_key} * to null in order to use returned value of {@link MappeableElement.get_map_key} * as key. * * {{{ - * public class YourObject : GomElement { + * public class YourObject : GXml.Element { * [Description (nick="::Name")] * public string name { get; set; } * } @@ -73,7 +73,7 @@ public class GXml.GomHashMap : GXml.BaseCollection, GXml.Map { * Convenient function to initialize a {@link GomHashMap} collection, using * given element, items' type and name. */ - public void initialize_element_with_key (GomElement element, + public void initialize_element_with_key (GXml.Element element, GLib.Type items_type, string attribute_key) throws GLib.Error { @@ -133,11 +133,11 @@ public class GXml.GomHashMap : GXml.BaseCollection, GXml.Map { * Return: false if element should not be added to collection. */ public override bool validate_append (int index, DomElement element) throws GLib.Error { - if (!(element is GomElement)) return false; + if (!(element is GXml.Element)) return false; #if DEBUG message ("Validating HashMap Element..." - +(element as GomElement).write_string () - +" Attrs:"+(element as GomElement).attributes.length.to_string()); + +(element as GXml.Element).write_string () + +" Attrs:"+(element as GXml.Element).attributes.length.to_string()); #endif string key = null; if (attribute_key != null) { diff --git a/gxml/GomHashPairedMap.vala b/gxml/GomHashPairedMap.vala index 7161ed91c641adeaebf942abca73d5aa4dff766c..86c0e13bcfdfddcae7006b51a63822259b0bad0d 100644 --- a/gxml/GomHashPairedMap.vala +++ b/gxml/GomHashPairedMap.vala @@ -33,7 +33,7 @@ using Gee; * it is not added; but keeps it as a child node of actual * {@link Collection.element}. * - * If {@link GomElement} to be added is of type {@link Collection.items_type} + * If {@link GXml.Element} to be added is of type {@link Collection.items_type} * and implements {@link MappeableElementPairKey}, you should set * {@link attribute_primary_key} and {@link attribute_secondary_key} * to null in order to use returned value of {@link MappeableElementPairKey.get_map_primary_key} @@ -41,7 +41,7 @@ using Gee; * as keys. * * {{{ - * public class YourObject : GomElement, MappeableElementPairKey { + * public class YourObject : GXml.Element, MappeableElementPairKey { * [Description (nick="::Name")] * public string name { get; set; } * public string code { get; set; } @@ -94,7 +94,7 @@ public class GXml.GomHashPairedMap : GXml.BaseCollection, GXml.PairedMap { * Convenient function to initialize a {@link GomHashMap} collection, using * given element, items' type and name. */ - public void initialize_element_with_keys (GomElement element, + public void initialize_element_with_keys (GXml.Element element, GLib.Type items_type, string attribute_primary_key, string attribute_secondary_key) throws GLib.Error @@ -184,11 +184,11 @@ public class GXml.GomHashPairedMap : GXml.BaseCollection, GXml.PairedMap { * Return: false if element should not be added to collection. */ public override bool validate_append (int index, DomElement element) throws GLib.Error { - if (!(element is GomElement)) return false; + if (!(element is GXml.Element)) return false; #if DEBUG message ("Validating HashMap Element..." - +(element as GomElement).write_string () - +" Attrs:"+(element as GomElement).attributes.length.to_string()); + +(element as GXml.Element).write_string () + +" Attrs:"+(element as GXml.Element).attributes.length.to_string()); #endif string pkey = null; string skey = null; diff --git a/gxml/GomHashThreeMap.vala b/gxml/GomHashThreeMap.vala index f836d69c6ca323862dcdcc64f4dc3c1f4f028750..ca921f365202b6d3febd97cc824723fcce4a2716 100644 --- a/gxml/GomHashThreeMap.vala +++ b/gxml/GomHashThreeMap.vala @@ -34,7 +34,7 @@ using Gee; * it is not added; but keeps it as a child node of actual * {@link Collection.element}. * - * If {@link GomElement} to be added is of type {@link Collection.items_type} + * If {@link GXml.Element} to be added is of type {@link Collection.items_type} * and implements {@link MappeableElementThreeKey}, you should set * {@link attribute_primary_key}, {@link attribute_secondary_key} * and {@link attribute_third_key} @@ -44,7 +44,7 @@ using Gee; * as keys. * * {{{ - * public class YourObject : GomElement, MappeableElementThirdKey { + * public class YourObject : GXml.Element, MappeableElementThirdKey { * [Description (nick="::Name")] * public string name { get; set; } * public string code { get; set; } @@ -112,7 +112,7 @@ public class GXml.GomHashThreeMap : GXml.BaseCollection, ThreeMap { * Convenient function to initialize a {@link GomHashMap} collection, using * given element, items' type and name. */ - public void initialize_element_with_keys (GomElement element, + public void initialize_element_with_keys (GXml.Element element, GLib.Type items_type, string attribute_primary_key, string attribute_secondary_key, @@ -240,7 +240,7 @@ public class GXml.GomHashThreeMap : GXml.BaseCollection, ThreeMap { * Return: false if element should not be added to collection. */ public override bool validate_append (int index, DomElement element) throws GLib.Error { - if (!(element is GomElement)) return false; + if (!(element is GXml.Element)) return false; string pkey = null; string skey = null; string tkey = null; diff --git a/gxml/GomObject.vala b/gxml/GomObject.vala index 562c30ee83a83b8be0619479c011bd945040b4f3..7348199b0ad9f4c81e3ee7ec855ce8a913e9c330 100644 --- a/gxml/GomObject.vala +++ b/gxml/GomObject.vala @@ -27,7 +27,7 @@ using GXml; * and children. All object's properties are handled as attributes if they are * basic types like integers, strings, enums and others; {@link SerializableProperty} * objects are handled as attributes too. If object's attribute is a {@link GLib.Object} - * it is handled as node's child, but only if it is a {@link GomElement} object, + * it is handled as node's child, but only if it is a {@link GXml.Element} object, * other wise it is ignored when this object is used as {@link DomNode} in XML * documents. */ @@ -317,7 +317,7 @@ public interface GXml.GomObject : GLib.Object, return null; } /** - * From a given property name of type {@link GomElement}, search all + * From a given property name of type {@link GXml.Element}, search all * child nodes with node's local name equal to property. */ public virtual DomElementList find_elements (string name) { @@ -365,7 +365,7 @@ public interface GXml.GomObject : GLib.Object, * * Instance is set ot object's property. * - * Property should be a {@link GomElement} or {@link Collection} + * Property should be a {@link GXml.Element} or {@link Collection} * * While an object could be created and set to a Object's property, it * is not correctly initialized by default. This method helps in the process. @@ -400,9 +400,9 @@ public interface GXml.GomObject : GLib.Object, set_property (prop.name, v); return true; } - if (prop.value_type.is_a (typeof (GomElement))) { + if (prop.value_type.is_a (typeof (GXml.Element))) { obj = Object.new (prop.value_type,"owner-document", this.owner_document); - try { this.append_child (obj as GomElement); } + try { this.append_child (obj as GXml.Element); } catch (GLib.Error e) { warning (_("Error while attempting to instantiate property object: %s").printf (e.message)); return false; @@ -415,7 +415,7 @@ public interface GXml.GomObject : GLib.Object, } /** * Utility method to remove all instances of a property being child elements - * of object. Is useful if you have a {@link GomElement} property, it should be + * of object. Is useful if you have a {@link GXml.Element} property, it should be * just one child of this type and you want to overwrite it. * * In this example you have defined an element MyClass to be child of @@ -423,10 +423,10 @@ public interface GXml.GomObject : GLib.Object, * it calls {@link clean_property_elements} using property's canonicals name. * * {{{ - * public class MyClass : GomElement { + * public class MyClass : GXml.Element { * public string name { get; set; } * } - * public class MyParentClass : GomElement { + * public class MyParentClass : GXml.Element { * private Myclass _child_elements = null; * public MyClass child_elements { * get { return _child_elements; } @@ -445,15 +445,15 @@ public interface GXml.GomObject : GLib.Object, * * @param name property name to search value type, use canonical names. * - * @throws DomError if property is not a {@link GomElement}. + * @throws DomError if property is not a {@link GXml.Element}. */ public virtual void clean_property_elements (string name) throws GLib.Error { var prop = get_class ().find_property (name); if (prop != null) { - if (!prop.value_type.is_a (typeof (GomElement))) - throw new DomError.TYPE_MISMATCH_ERROR (_("Can't set value. It is not a GXmlGomElement type")); + if (!prop.value_type.is_a (typeof (GXml.Element))) + throw new DomError.TYPE_MISMATCH_ERROR (_("Can't set value. It is not a GXmlGXml.Element type")); var l = find_elements (name); if (l.length != 0) { foreach (DomElement e in l) { diff --git a/gxml/GomSchema.vala b/gxml/GomSchema.vala index 8af24cdba9258bea3d05c4168d15d471c8df04dc..c7b70ddaedfe2a7290330389b42102a4f9edffb5 100644 --- a/gxml/GomSchema.vala +++ b/gxml/GomSchema.vala @@ -24,7 +24,7 @@ using GXml; /** * Reference interfaces for XSD support. */ -public class GXml.GomXsdSchema : GomElement { +public class GXml.GomXsdSchema : GXml.Element { public GomXsdListElements element_definitions { get; set; } public GomXsdListSimpleTypes simple_type_definitions { get; set; } public GomXsdListComplexTypes complex_type_definitions { get; set; } @@ -35,7 +35,7 @@ public class GXml.GomXsdSchema : GomElement { } } -public class GXml.GomXsdSimpleType : GomElement { +public class GXml.GomXsdSimpleType : GXml.Element { /** * (#all | List of (list | union | restriction | extension)) */ @@ -54,7 +54,7 @@ public class GXml.GomXsdSimpleType : GomElement { } } -public class GXml.GomXsdTypeDefinition : GomElement { +public class GXml.GomXsdTypeDefinition : GXml.Element { public GomXsdAnnotation annotation { get; set; } } public class GXml.GomXsdTypeList : GomXsdTypeDefinition {} @@ -72,7 +72,7 @@ public class GXml.GomXsdTypeRestriction : GomXsdTypeDefinition { } } -public class GXml.GomXsdTypeRestrictionDef : GomElement { +public class GXml.GomXsdTypeRestrictionDef : GXml.Element { public GomXsdAnnotation annotation { get; set; } } public class GXml.GomXsdTypeRestrictionMinExclusive : GomXsdTypeRestrictionDef {} @@ -152,7 +152,7 @@ public class GXml.GomXsdComplexType : GomXsdBaseType { } } -public class GXml.GomXsdExtension : GomElement { +public class GXml.GomXsdExtension : GXml.Element { [Description (nick="::base")] public string base { get; set; } construct { @@ -162,7 +162,7 @@ public class GXml.GomXsdExtension : GomElement { } } -public class GXml.GomXsdElement : GomElement { +public class GXml.GomXsdElement : GXml.Element { /** * attribute name = abstract */ @@ -232,14 +232,14 @@ public class GXml.GomXsdElement : GomElement { } -public class GXml.GomXsdAnnotation : GomElement { +public class GXml.GomXsdAnnotation : GXml.Element { } -public class GXml.GomXsdBaseType : GomElement { +public class GXml.GomXsdBaseType : GXml.Element { public GomXsdAnnotation anotation { get; set; } } -public class GXml.GomXsdBaseContent : GomElement { +public class GXml.GomXsdBaseContent : GXml.Element { public GomXsdAnnotation anotation { get; set; } } public class GXml.GomXsdSimpleContent : GomXsdBaseContent { @@ -250,7 +250,7 @@ public class GXml.GomXsdComplexContent : GomXsdBaseContent { } public class GXml.GomXsdOpenContent : GomXsdBaseContent {} -public class GXml.GomXsdBaseAttribute : GomElement { +public class GXml.GomXsdBaseAttribute : GXml.Element { public GomXsdAnnotation anotation { get; set; } } public class GXml.GomXsdAttribute : GomXsdBaseAttribute {} diff --git a/gxml/Node.vala b/gxml/Node.vala index 1e1c23baf5e8da5948cc97e1777904c6c67036f7..5445cdd6d33951b309944bbe19559e132d09d4d0 100644 --- a/gxml/Node.vala +++ b/gxml/Node.vala @@ -218,7 +218,7 @@ public class GXml.Node : Object, if (this is GXml.DomDocumentType || this is GXml.DomDocumentFragment) return null; if (this is DomElement) { - return (this as GomElement).lookup_prefix (nspace); + return (this as GXml.Element).lookup_prefix (nspace); } if (this is GXml.Attr) { if (this.parent_node == null) return null; @@ -230,7 +230,7 @@ public class GXml.Node : Object, if (this is GXml.DomDocumentType || this is GXml.DomDocumentFragment) return null; if (this is DomElement) { - return (this as GomElement).lookup_namespace_uri (prefix); + return (this as GXml.Element).lookup_namespace_uri (prefix); } if (this is GXml.Attr) { if (this.parent_node == null) return null; diff --git a/gxml/Parser.vala b/gxml/Parser.vala index bf754125c0d8171ea97a3ce7bf3b8e9cec40fa3b..3f18b1042525c6d7c38b0fb4da847b533eb4b630 100644 --- a/gxml/Parser.vala +++ b/gxml/Parser.vala @@ -256,7 +256,7 @@ public interface GXml.Parser : Object { throw new DomError.INVALID_NODE_TYPE_ERROR (_("Invalid DomElement name for objects in Collection")); } - if (col.element == null || !(col.element is GomElement)) { + if (col.element == null || !(col.element is GomObject)) { throw new DomError.INVALID_NODE_TYPE_ERROR (_("Invalid Element set to Collection")); } diff --git a/gxml/XParser.vala b/gxml/XParser.vala index 0c190597adb01e3081bf6fc8916045333770926e..d4008ab493816307fe0feca4670a9bb6f12e2e66 100644 --- a/gxml/XParser.vala +++ b/gxml/XParser.vala @@ -208,14 +208,14 @@ public class GXml.XParser : Object, GXml.Parser { if (current_is_element () && (node is DomDocument)) read_child_element (node); else { - if (node is GXml.Document) { + if (node is GXml.DomDocument) { read_child_nodes (node); } - if (node is GomElement) { - if ((node as GomElement).parse_children) + if (node is GXml.Element) { + if ((node as GXml.Element).parse_children) read_child_nodes (node); else { - (node as GomElement).unparsed = read_unparsed (); + (node as GXml.Element).unparsed = read_unparsed (); //warning ("Unparsed text: "+(node as GomObject).unparsed); move_next_node (); } diff --git a/gxml/meson.build b/gxml/meson.build index 5083bcd44a9b12f0dd6aabe598e4d70d5254395a..0aa829c87942c51f6e5af286d42913372d7a341d 100644 --- a/gxml/meson.build +++ b/gxml/meson.build @@ -51,10 +51,10 @@ valasources = files ([ 'DomMutationObservers.vala', 'DomNode.vala', 'DomRange.vala', + 'Element.vala', 'Enumeration.vala', 'Event.vala', 'GomBaseCollection.vala', - 'GomElement.vala', 'GomHashMap.vala', 'GomHashPairedMap.vala', 'GomHashThreeMap.vala', diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala index 82ea3d7f512e8a63b42cf55ee8499c937888db3b..a0ce58bfbd04a9849f7fb3e7aa8d0c091da9d328 100644 --- a/test/DocumentTest.vala +++ b/test/DocumentTest.vala @@ -31,7 +31,7 @@ class GXml.DocumentTest : GXmlTest { "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"); try { append_child (dt); } catch (GLib.Error e) { warning ("Error: "+e.message); } } - public class ObjectParent : GomElement { + public class ObjectParent : GXml.Element { construct { try { initialize ("root"); } catch (GLib.Error e) { warning ("Error: "+e.message); } @@ -47,7 +47,7 @@ class GXml.DocumentTest : GXmlTest { } } public ObjectChild child { get; set; } - public class ObjectChild : GomElement { + public class ObjectChild : GXml.Element { construct { try { initialize ("child"); } catch (GLib.Error e) { warning ("Error: "+e.message); } @@ -324,7 +324,7 @@ class GXml.DocumentTest : GXmlTest { DomElement elem = null; elem = (DomElement) doc.create_element ("Banana"); assert (elem is DomElement); - assert (elem is GomElement); + assert (elem is GXml.Element); assert (elem.tag_name == "Banana"); assert (elem.tag_name != "banana"); @@ -565,10 +565,10 @@ class GXml.DocumentTest : GXmlTest { Test.add_func ("/gxml/gom-document/write/string", () => { try { var d = new GXml.Document (); - var n = d.create_element ("Node") as GomElement; + var n = d.create_element ("Node") as GXml.Element; d.append_child (n); n.set_attribute ("name","value"); - var n2 = d.create_element ("Node2") as GomElement; + var n2 = d.create_element ("Node2") as GXml.Element; n.append_child (n2); message (d.write_string ()); string str = d.write_string (); diff --git a/test/GomElementTest.vala b/test/ElementTest.vala similarity index 96% rename from test/GomElementTest.vala rename to test/ElementTest.vala index bd0f9727382bb3e3f6fe2408386525435eb5e98d..4f5a7a72c14bb06e3dcdb19f5577bca3beae510b 100644 --- a/test/GomElementTest.vala +++ b/test/ElementTest.vala @@ -27,7 +27,7 @@ public interface NoInstantiatable : Object, GomObject { } public interface Property : Object, GomProperty {} -class ObjectParent : GomElement { +class ObjectParent : GXml.Element { construct { try { initialize ("root"); } catch (GLib.Error e) { warning ("Error: "+e.message); } @@ -49,7 +49,7 @@ class ObjectParent : GomElement { } } public ObjectChild child { get; set; } - public class ObjectChild : GomElement { + public class ObjectChild : GXml.Element { construct { try { initialize ("child"); } catch (GLib.Error e) { warning ("Error: "+e.message); } @@ -57,20 +57,20 @@ class ObjectParent : GomElement { } } -class GomElementTest : GXmlTest { - public class ParsedDelayed : GomElement { +class GXml.ElementTest : GXmlTest { + public class ParsedDelayed : GXml.Element { construct { try { initialize ("root"); } catch (GLib.Error e) { warning ("Error: "+e.message); } parse_children = false; } } - public class Instantiatable : GomElement, NoInstantiatable { + public class Instantiatable : GXml.Element, NoInstantiatable { [Description (nick="::name")] public string name { get; set; } construct { initialize ("Instantiatable"); } } - public class Top : GomElement { + public class Top : GXml.Element { public NoInstantiatable inst { get { return inst_i; } set { inst_i = value as Instantiatable; } } @@ -80,7 +80,7 @@ class GomElementTest : GXmlTest { construct { initialize ("Top"); } } public class GProperty : GomString, Property {} - public class GTop : GomElement { + public class GTop : GXml.Element { public NoInstantiatable inst { get; set; } public Instantiatable inst_i { get { return inst as Instantiatable; } @@ -99,7 +99,7 @@ class GomElementTest : GXmlTest { public Property pq { get; set; } construct { initialize ("Top"); } } - public class Potion : GomElement { + public class Potion : GXml.Element { [Description (nick="::c:name")] public string cname { get; set; } public Ingredient ingredient { get; set; } @@ -110,7 +110,7 @@ class GomElementTest : GXmlTest { } catch (GLib.Error e) { warning ("Error: "+e.message); } } } - public class Ingredient : GomElement, MappeableElement { + public class Ingredient : GXml.Element, MappeableElement { [Description (nick="::c:name")] public string cname { get; set; } public Method.Map methods { get; set; } @@ -124,7 +124,7 @@ class GomElementTest : GXmlTest { } } } - public class Method : GomElement, MappeableElement { + public class Method : GXml.Element, MappeableElement { [Description (nick="::c:name")] public string cname { get; set; } construct { initialize ("method"); } @@ -137,7 +137,7 @@ class GomElementTest : GXmlTest { } } } - public class Repository : GomElement + public class Repository : GXml.Element { [Description (nick="::version")] public string version { get; set; } @@ -157,7 +157,7 @@ class GomElementTest : GXmlTest { version = "1.2"; } } - public class Namespace : GomElement + public class Namespace : GXml.Element { TClass.Map _classes; [Description (nick="::name")] @@ -187,7 +187,7 @@ class GomElementTest : GXmlTest { catch (GLib.Error e) { warning ("Error: "+e.message); } } } - public class TClass : GomElement, MappeableElement + public class TClass : GXml.Element, MappeableElement { [Description (nick="::name")] public string name { get; set; } @@ -251,7 +251,7 @@ class GomElementTest : GXmlTest { assert ((node as DomElement).namespace_uri == "http://hogwarts.co.uk/magic"); assert ((node as DomElement).prefix == "magic"); #if DEBUG - message ("Element: "+(node as GomElement).write_string ()); + message ("Element: "+(node as GXml.Element).write_string ()); message ("Attributes: "+(node as DomElement).attributes.length.to_string ()); foreach (string k in (node as DomElement).attributes.keys) { string v = (node as DomElement).get_attribute (k); @@ -259,7 +259,7 @@ class GomElementTest : GXmlTest { GLib.message ("Attribute: "+k+"="+v); } #endif - message ((node as GomElement).write_string ()); + message ((node as GXml.Element).write_string ()); assert ((node as DomElement).attributes.length == 2); assert ((node as DomElement).get_attribute ("xmlns:magic") == "http://hogwarts.co.uk/magic"); assert ((node as DomElement).get_attribute_ns ("http://www.w3.org/2000/xmlns/", "magic") == "http://hogwarts.co.uk/magic"); @@ -301,7 +301,7 @@ class GomElementTest : GXmlTest { try { GXml.Document doc = new GXml.Document.from_string (""); assert (doc.document_element != null); - GomElement elem = (GomElement) doc.create_element ("alphanumeric"); + GXml.Element elem = (GXml.Element) doc.create_element ("alphanumeric"); doc.document_element.child_nodes.add (elem); assert (elem.attributes != null); assert (elem.attributes.size == 0); @@ -361,7 +361,7 @@ class GomElementTest : GXmlTest { assert (elem.lookup_namespace_uri ("xtest") == "http://www.w3c.org/test"); assert (n.lookup_namespace_uri ("xtest") == "http://www.w3c.org/test"); assert (child.lookup_namespace_uri ("xtest") == "http://www.w3c.org/test"); - message ((elem as GomElement).write_string ()); + message ((elem as GXml.Element).write_string ()); child.set_attribute_ns ("http://www.w3c.org/test","xtest:val","Value"); assert (elem.get_attribute_ns ("http://www.w3.org/2000/xmlns/","xtest") == "http://www.w3c.org/test"); assert (elem.get_attribute_ns ("http://www.w3.org/2000/xmlns","xtest") == "http://www.w3c.org/test"); @@ -403,7 +403,7 @@ class GomElementTest : GXmlTest { - + """; @@ -425,7 +425,7 @@ class GomElementTest : GXmlTest { - + """; @@ -445,9 +445,9 @@ class GomElementTest : GXmlTest { Test.add_func ("/gxml/gom-element/content/add_aside_child_nodes", () =>{ try { var doc = new GXml.Document (); - var root = (GomElement) doc.create_element ("root"); + var root = (GXml.Element) doc.create_element ("root"); doc.child_nodes.add (root); - var n = (GomElement) doc.create_element ("child"); + var n = (GXml.Element) doc.create_element ("child"); root.child_nodes.add (n); var t = doc.create_text_node ("TEXT1"); root.child_nodes.add (t); @@ -462,9 +462,9 @@ class GomElementTest : GXmlTest { Test.add_func ("/gxml/gom-element/content/keep_child_nodes", () =>{ try { var doc = new GXml.Document (); - var root = (GomElement) doc.create_element ("root"); + var root = (GXml.Element) doc.create_element ("root"); doc.child_nodes.add (root); - var n = (GomElement) doc.create_element ("child"); + var n = (GXml.Element) doc.create_element ("child"); root.child_nodes.add (n); var t = doc.create_text_node ("TEXT1") as DomText; root.child_nodes.add (t); @@ -525,10 +525,10 @@ class GomElementTest : GXmlTest { }); Test.add_func ("/gxml/gom-element/write/string", () => { try { - var n = new GomElement (); + var n = new GXml.Element (); n.initialize ("Node"); n.set_attribute ("name","value"); - var n2 = n.owner_document.create_element ("Node2") as GomElement; + var n2 = n.owner_document.create_element ("Node2") as GXml.Element; n.append_child (n2); string str = n.write_string (); assert (" { try { - var n = new GomElement (); + var n = new GXml.Element (); n.initialize ("Node"); n.set_attribute ("name","value"); var ostream = new MemoryOutputStream.resizable (); @@ -558,7 +558,7 @@ class GomElementTest : GXmlTest { }); Test.add_func ("/gxml/gom-element/write/input_stream", () => { try { - var n = new GomElement (); + var n = new GXml.Element (); n.initialize ("Node"); n.set_attribute ("name","value"); var ostream = new MemoryOutputStream.resizable (); @@ -690,7 +690,7 @@ class GomElementTest : GXmlTest { }); Test.add_func ("/gxml/gom-element/ordered-attributes", () => { try { - var e = new GomElement (); + var e = new GXml.Element (); e.set_attribute ("a1", "v1"); e.set_attribute ("a2", "v2"); e.set_attribute ("a3", "v3"); @@ -718,7 +718,7 @@ class GomElementTest : GXmlTest { assert (e.attributes.item (2).node_value == "v4"); assert (e.attributes.item (3) == null); - var e2 = new GomElement (); + var e2 = new GXml.Element (); e2.set_attribute_ns ("http://www.w3.org/2000/xmlns", "xmlns:gxml", "http://wiki.gnome.org/GXml"); e2.set_attribute_ns ("http://wiki.gnome.org/GXml", "gxml:a1", "v1"); e2.set_attribute_ns ("http://wiki.gnome.org/GXml", "gxml:a2", "v2"); diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala index ada23551077307515c2066c0b7725d7097c2e969..2b5cc049363d017e624dd1d24266d15f4c108eaa 100644 --- a/test/GXmlTest.vala +++ b/test/GXmlTest.vala @@ -35,8 +35,8 @@ class GXmlTest { DomXDocumentTest.add_tests (); XPathTest.add_tests (); DocumentTest.add_tests (); - GomElementTest.add_tests (); - GomSerializationTest.add_tests (); + ElementTest.add_tests (); + SerializationTest.add_tests (); GomSchemaTest.add_tests (); CssSelectorTest.add_tests (); diff --git a/test/GomSerializationTest.vala b/test/SerializationTest.vala similarity index 98% rename from test/GomSerializationTest.vala rename to test/SerializationTest.vala index fe0c6fde68fc94c569bb5e9d3894d1b762c876ea..68afa61da27736159460756bb2ea2656760b8bf4 100644 --- a/test/GomSerializationTest.vala +++ b/test/SerializationTest.vala @@ -23,7 +23,7 @@ using GXml; // GOM Collection Definitions -class ThreeKeys : GomElement { +class ThreeKeys : GXml.Element { private ThreeKey.Map _map; public ThreeKey.Map map { get { @@ -40,7 +40,7 @@ class ThreeKeys : GomElement { } construct { try { initialize ("ThreeKeys"); } catch { assert_not_reached (); } } } -class ThreeKey : GomElement, MappeableElementThreeKey { +class ThreeKey : GXml.Element, MappeableElementThreeKey { [Description (nick="::ID")] public string id { get; set; } [Description (nick="::Code")] @@ -58,7 +58,7 @@ class ThreeKey : GomElement, MappeableElementThreeKey { } } } -class Operations : GomElement { +class Operations : GXml.Element { private Operation.Map _map; public Operation.Map map { get { @@ -75,7 +75,7 @@ class Operations : GomElement { } construct { try { initialize ("Operations"); } catch { assert_not_reached (); } } } -class Operation : GomElement, MappeableElementPairKey { +class Operation : GXml.Element, MappeableElementPairKey { [Description (nick="::ID")] public string id { get; set; } [Description (nick="::Code")] @@ -90,17 +90,17 @@ class Operation : GomElement, MappeableElementPairKey { } } } -class GomName : GomElement +class GomName : GXml.Element { construct { try { initialize ("Name"); } catch { assert_not_reached (); } } } -class GomEmail : GomElement +class GomEmail : GXml.Element { construct { try { initialize ("Email"); } catch { assert_not_reached (); } } } -class GomAuthor : GomElement +class GomAuthor : GXml.Element { public GomName name { get; set; } public GomEmail email { get; set; } @@ -111,14 +111,14 @@ class GomAuthor : GomElement } } -class GomAuthors : GomElement +class GomAuthors : GXml.Element { public string number { get; set; } construct { try { initialize ("Authors"); } catch { assert_not_reached (); } } public GomAuthor.Array array { get; set; } } -class GomInventory : GomElement +class GomInventory : GXml.Element { [Description (nick="::Number")] public int number { get; set; } @@ -136,7 +136,7 @@ class GomInventory : GomElement } } -class GomCategory : GomElement +class GomCategory : GXml.Element { [Description (nick="::Name")] public string name { get; set; } @@ -150,7 +150,7 @@ class GomCategory : GomElement } -class GomResume : GomElement +class GomResume : GXml.Element { [Description (nick="::Chapter")] public string chapter { get; set; } @@ -165,7 +165,7 @@ class GomResume : GomElement } } -class GomBook : GomElement +class GomBook : GXml.Element { [Description(nick="::Year")] public string year { get; set; } @@ -187,7 +187,7 @@ class GomBook : GomElement } } -class GomBookStore : GomElement +class GomBookStore : GXml.Element { [Description (nick="::name")] public string name { get; set; } @@ -197,7 +197,7 @@ class GomBookStore : GomElement } } -class GomBasicTypes : GomElement { +class GomBasicTypes : GXml.Element { [Description (nick="::text")] public string text { get; set; } [Description (nick="::integer")] @@ -215,8 +215,8 @@ class GomBasicTypes : GomElement { } } -class GomSerializationTest : GXmlTest { - public class Book : GomElement { +class SerializationTest : GXmlTest { + public class Book : GXml.Element { [Description (nick="::Name")] public string name { get; set; } construct { try { initialize ("Book"); } catch { assert_not_reached (); } } @@ -235,7 +235,7 @@ class GomSerializationTest : GXmlTest { return s; } } - public class Computer : GomElement { + public class Computer : GXml.Element { [Description (nick="::Model")] public string model { get; set; } public string ignore { get; set; } // ignored property @@ -252,7 +252,7 @@ class GomSerializationTest : GXmlTest { return s; } } - public class Taxes : GomElement { + public class Taxes : GXml.Element { [Description (nick="::monthRate")] public double month_rate { get; set; } [Description (nick="::TaxFree")] @@ -280,7 +280,7 @@ class GomSerializationTest : GXmlTest { FEBRUARY } } - public class BookRegister : GomElement, + public class BookRegister : GXml.Element, MappeableElement, MappeableElementPairKey, MappeableElementThreeKey { @@ -340,7 +340,7 @@ class GomSerializationTest : GXmlTest { return s; } } - public class BookStand : GomElement { + public class BookStand : GXml.Element { HashRegisters _hashmap_registers = null; HashPairRegisters _hashpair_registers = null; HashThreeRegisters _hashthree_registers = null; @@ -400,7 +400,7 @@ class GomSerializationTest : GXmlTest { } return s; } - public class Dimension : GomElement { + public class Dimension : GXml.Element { [Description (nick="::Length")] public double length { get; set; default = 1.0; } [Description (nick="::Type")] @@ -451,7 +451,7 @@ class GomSerializationTest : GXmlTest { catch { assert_not_reached (); } } } - public class BookStore : GomElement { + public class BookStore : GXml.Element { [Description (nick="::Name")] public string name { get; set; } public Books books { get; set; } @@ -470,7 +470,7 @@ class GomSerializationTest : GXmlTest { return s; } } - public class Motor : GomElement { + public class Motor : GXml.Element { [Description (nick="::On")] public On is_on { get; set; } [Description (nick="::Torque")] diff --git a/test/meson.build b/test/meson.build index 359101be9ab2f8ab2b3d5abe7c9ba5cfeca34adb..2f48b0819ffcdd3801719f2e9db9deb3a501965b 100644 --- a/test/meson.build +++ b/test/meson.build @@ -10,8 +10,8 @@ files_tests = files ([ 'XHtmlDocumentTest.vala', 'DomXDocumentTest.vala', 'DocumentTest.vala', - 'GomElementTest.vala', - 'GomSerializationTest.vala', + 'ElementTest.vala', + 'SerializationTest.vala', 'GomSchemaTest.vala', 'XElementTest.vala', 'XPathTest.vala',