[gxml] GomElement: More flexible to declare namespaces
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomElement: More flexible to declare namespaces
- Date: Sat, 8 Apr 2017 14:57:29 +0000 (UTC)
commit ebe7ce0dfde0de5bbf15566db880e8ef14b1e48a
Author: Daniel Espinosa <esodan gmail com>
Date: Sat Apr 8 09:26:38 2017 -0500
GomElement: More flexible to declare namespaces
Name spaces declarations should use one of these:
http://www.w3.org/2000/xmlns/
or
http://www.w3.org/2000/xmlns
configure.ac | 2 +-
gxml/GomElement.vala | 4 +++-
test/GomElementTest.vala | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ffc2941..0495705 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@
# Release Version
m4_define([project_major_version], [0])
m4_define([project_minor_version], [14])
-m4_define([project_micro_version], [2])
+m4_define([project_micro_version], [3])
m4_define([project_nano_version], [0])
# LT_VERSION
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index ce17bfe..e365f76 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -539,7 +539,9 @@ public class GXml.GomElement : GomNode,
throw new DomError.NAMESPACE_ERROR (_("Invalid namespace. If prefix is xml, namespace URI should be
http://www.w3.org/2000/xmlns/"));
if (p == "xmlns" && namespace_uri != "http://www.w3.org/2000/xmlns/")
throw new DomError.NAMESPACE_ERROR (_("Invalid namespace. If attribute's prefix is xmlns, namespace
URI should be http://www.w3.org/2000/xmlns/"));
- if (p == "" && n == "xmlns" && namespace_uri != "http://www.w3.org/2000/xmlns/")
+ if (p == "" && n == "xmlns"
+ && (namespace_uri != "http://www.w3.org/2000/xmlns/"
+ && namespace_uri != "http://www.w3.org/2000/xmlns"))
throw new DomError.NAMESPACE_ERROR (_("Invalid namespace. If attribute's name is xmlns, namespace URI
should be http://www.w3.org/2000/xmlns/"));
if (p == "" && n != "xmlns" && n != "xml")
throw new DomError.NAMESPACE_ERROR (_("Invalid attribute name. No prefixed attributes should use xmlns
name"));
diff --git a/test/GomElementTest.vala b/test/GomElementTest.vala
index 0d7677a..64ff3cf 100644
--- a/test/GomElementTest.vala
+++ b/test/GomElementTest.vala
@@ -51,6 +51,7 @@ class GomElementTest : GXmlTest {
assert ((node as DomElement).get_attribute_ns
("http://www.w3.org/2000/xmlns/","products") == "http://diagonalley.co.uk/products");
assert (node.lookup_prefix ("http://diagonalley.co.uk/products") ==
"products");
assert (node.lookup_namespace_uri ("products") ==
"http://diagonalley.co.uk/products");
+ (node as DomElement).set_attribute_ns ("http://www.w3.org/2000/xmlns",
"xmlns:gxmlt","http://org.gnome.org/GXmlTest/");
} catch (GLib.Error e) {
GLib.message (e.message);
assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]