teal-src/util/datamapper.tl
changeset 11480 83e127eb91f9
parent 11479 9bd36e871f05
child 11483 377a9eaf7bef
--- a/teal-src/util/datamapper.tl	Mon Mar 22 22:24:39 2021 +0100
+++ b/teal-src/util/datamapper.tl	Tue Mar 23 19:52:59 2021 +0100
@@ -61,7 +61,7 @@
 	local proptype : json_type_name = "string"
 	local value_where : value_goes = propname and "in_text_tag" or "in_text"
 	local name = propname
-	local namespace = current_ns
+	local namespace : string
 	local prefix : string
 	local single_attribute : string
 	local enums : { any }
@@ -82,7 +82,7 @@
 			if xml.name then
 				name = xml.name
 			end
-			if xml.namespace then
+			if xml.namespace and xml.namespace ~= current_ns then
 				namespace = xml.namespace
 			end
 			if xml.prefix then
@@ -137,7 +137,7 @@
 		local attr = name
 		if prefix then
 			attr = prefix .. ':' .. name
-		elseif namespace ~= s.attr.xmlns then
+		elseif namespace and namespace ~= s.attr.xmlns then
 			attr = namespace .. "\1" .. name
 		end
 		return s.attr[attr]
@@ -250,7 +250,7 @@
 		local attr = name
 		if prefix then
 			attr = prefix .. ':' .. name
-		elseif namespace ~= current_ns then
+		elseif namespace and namespace ~= current_ns then
 			attr = namespace .. "\1" .. name
 		end
 
@@ -261,7 +261,7 @@
 		assert(single_attribute)
 		local propattr : { string : string } = {}
 
-		if namespace ~= current_ns then
+		if namespace and namespace ~= current_ns then
 			propattr.xmlns = namespace
 		end