diff --git a/lib/helper/XML.js b/lib/helper/XML.js index e9613d31..98763362 100644 --- a/lib/helper/XML.js +++ b/lib/helper/XML.js @@ -86,7 +86,9 @@ var XML = (function () { XML.createElement = function (name, attributes, text) { if (!attributes) attributes = {}; - var lindex = Math.max(name.lastIndexOf(':'), name.lastIndexOf('/')) + 1; + var li1 = name.lastIndexOf(':'); + var li2 = name.indexOf(':'); + var lindex = Math.max(li1 === li2 ? -1 : li2, name.lastIndexOf('/')) + 1; if (lindex !== 0) { attributes['xmlns:x'] = name.substring(0, lindex); name = 'x:' + name.substring(lindex); diff --git a/src/helper/XML.ts b/src/helper/XML.ts index d2517ba7..02a613b2 100644 --- a/src/helper/XML.ts +++ b/src/helper/XML.ts @@ -122,7 +122,9 @@ export abstract class XML if(!attributes) attributes = {}; - const lindex = Math.max(name.lastIndexOf(':'), name.lastIndexOf('/')) + 1; + const li1 = name.lastIndexOf(':'); + const li2 = name.indexOf(':'); + const lindex = Math.max(li1 === li2 ? -1 : li2, name.lastIndexOf('/')) + 1; if(lindex !== 0) { attributes['xmlns:x'] = name.substring(0, lindex);