summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/js/htdocs/xmlutil.js
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-05-23 06:31:39 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-05-23 06:31:39 +0000
commitbc2aa6314a8d82854a799fe1e750c05dcef1b492 (patch)
tree0fcda568552ed214683230b81793a9f69a467db1 /sca-cpp/trunk/modules/js/htdocs/xmlutil.js
parent4aa0b8bca183523fab66e655ae6652bfea42255d (diff)
Some Javascript cleanup, now working across all browsers including IE9.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1126329 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/js/htdocs/xmlutil.js')
-rw-r--r--sca-cpp/trunk/modules/js/htdocs/xmlutil.js30
1 files changed, 12 insertions, 18 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/xmlutil.js b/sca-cpp/trunk/modules/js/htdocs/xmlutil.js
index 3965596599..4d943cce75 100644
--- a/sca-cpp/trunk/modules/js/htdocs/xmlutil.js
+++ b/sca-cpp/trunk/modules/js/htdocs/xmlutil.js
@@ -111,19 +111,8 @@ function isXML(l) {
*/
function parseXML(l) {
var s = writeStrings(l);
- if (window.DOMParser) {
- var p = new DOMParser();
- return p.parseFromString(s, "text/xml");
- }
- var doc;
- try {
- doc = new ActiveXObject("MSXML2.DOMDocument");
- } catch (e) {
- doc = new ActiveXObject("Microsoft.XMLDOM");
- }
- doc.async = 'false';
- doc.loadXML(s);
- return doc;
+ var p = new DOMParser();
+ return p.parseFromString(s, "text/xml");
}
/**
@@ -196,7 +185,12 @@ function writeList(l, node, doc) {
var token = car(l);
if (isTaggedList(token, attribute)) {
- node.setAttribute(attributeName(token).substring(1), '' + attributeValue(token));
+ if (isIE()) {
+ var aname = attributeName(token).substring(1);
+ if (aname != 'xmlns')
+ node.setAttribute(aname, '' + attributeValue(token));
+ } else
+ node.setAttribute(attributeName(token).substring(1), '' + attributeValue(token));
} else if (isTaggedList(token, element)) {
@@ -213,7 +207,9 @@ function writeList(l, node, doc) {
}
var ns = xmlns(elementChildren(tok));
- if (ns == null || !doc.createElementNS)
+ if (isIE())
+ return doc.createElementNS(ns != null? ns : node.namespaceURI, elementName(tok).substring(1));
+ if (ns == null)
return doc.createElement(elementName(tok).substring(1));
return doc.createElementNS(ns, elementName(tok).substring(1));
}
@@ -244,9 +240,7 @@ function writeList(l, node, doc) {
* Make a new XML document.
*/
function mkXMLDocument() {
- if (document.implementation && document.implementation.createDocument)
- return document.implementation.createDocument('', '', null);
- return new ActiveXObject("MSXML2.DOMDocument");
+ return document.implementation.createDocument('', '', null);
}
/**