CES wrote:
Is their a way of testing if their is an XML parser installed and what the
version number is with in JavaScript???
If you are thinking about MS IE on Windows then you can test for Msxml e.g.
<script type="text/jscript">
var xmlDocument = null;
var highestVersion = 0;
var currentVersion;
var versionStrings = [
'Msxml2.DOMDocument.3.0',
'Msxml2.DOMDocument.4.0',
'Msxml2.DOMDocument.5.0',
'Msxml2.DOMDocument.6.0',
];
if (typeof ActiveXObject != 'undefined') {
for (var v = 0; v < versionStrings.length; v++) {
try {
currentVersion = versionStrings[v];
xmlDocument = new ActiveXObject(currentVersion);
highestVersion = currentVersion;
}
catch (e) {
break;
}
}
}
if (highestVersion) {
alert('Found support for ' + hightestVersion);
}
else {
alert('No support for found.');
}
</script>
The above should show the latest version of Msxml2.DOMDocument
available. Note that it only checks for versions that implement the W3C
XSLT and XPath 1.0 recommendation while there are earlier version like
Msxml2.DOMDocument.2.6 and 2.0 I think which allow DOM scripting but are
not compliant with the XSLT/XPath standards thus if you don't need
XPath/XSLT you might want to check for the earlier version too.
For DOM compliant implementations in browsers like Mozilla, Netscape 7
or Opera 7 you could try DOM methods like hasFeature e.g.
document.implementation.hasFeature('XML', '1.0')
document.implementation.hasFeature('Core', '2.0')
but only Mozilla thinks it has enough support to yield true on those
both while Opera 7.50 even for 1.0 returns false.
Other than that I am not sure what you have in mind with a version number.
--
Martin Honnen
http://JavaScript.FAQTs.com/