473,769 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Testing for an XML parser

CES
All,
Is their a way of testing if their is an XML parser installed and what the
version number is with in JavaScript???
Thanks in advance.
CES
Jul 23 '05 #1
1 1524


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.DOMDocu ment.3.0',
'Msxml2.DOMDocu ment.4.0',
'Msxml2.DOMDocu ment.5.0',
'Msxml2.DOMDocu ment.6.0',
];
if (typeof ActiveXObject != 'undefined') {
for (var v = 0; v < versionStrings. length; v++) {
try {
currentVersion = versionStrings[v];
xmlDocument = new ActiveXObject(c urrentVersion);
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.DOMDocum ent
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.DOMDocum ent.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.implem entation.hasFea ture('XML', '1.0')
document.implem entation.hasFea ture('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/

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3689
by: Tom Verbeure | last post by:
Hello All, so I'm now convinced that unit testing is really the way to go and I want to add it to an existing project. The first thing that I find out, is that, well, it's hard work. Harder than writing the real functional code. My application manipulates graphs. I first write the skeleton in Python, then convert it to C++ for high performance (some graphs can have millions of nodes.)
1
5286
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o Modules/python.c gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o...
0
1638
by: Badebecq | last post by:
I am new to Java and XML and I am trying to solve a problem that has bothered for few days. I have download the parser Xerser-1.4.4 and j2sdk1.4.1_04 I install the JDK first and test it, it works. Then I install the parser, using this command right under the C drive. jar xf xerces-j-bin.1.4.4.zip This creates a directory named xerces-1_4_4. I set the CLASSPATH to
11
1612
by: Richard | last post by:
www.geocities.com/r_bullis/test1.html At least this menu works in netscape. Disregarding the colors of the divisions. Those will be removed later. What I'm looking at doing is to have the "text" beside the images more centered with the image and perhaps a bit more to the right. I'm not sure if it's within the javascript, but I keep finding roadblocks to do it the way I want to.
1
1118
by: Jacek | last post by:
Hi All! Currently I am in testing phase of developed by me in C# parser for ISO C++ and hopefully providing full support for VC++ as well. Unfortunately preprocessor has to be off now so for tests I use files preprocessed with /P option set on cl.exe command line. Despite the fact that parser successfully passes all current tests (STL source code and all of ATL/MFC plus many source bases available publicly) I do plan to run it on all...
3
1507
by: astromog | last post by:
I have some significantly extended syntax for Python that I need to create a reference implementation for. My new syntax includes new keywords, statements and objects that are sort of like classes but not really. The implementation is all possible using standard Python, but the implementation isn't the point of what I'm doing. Speed and having an extra step to run a program are not issues that I need to be concerned with. I'd like to...
7
1501
by: Dick | last post by:
I have some simple (private) types... Friend Enum Types Value1 Value2 End Enum Friend Structure Detail Dim Type As Types End Structure
5
1304
by: Jens Theisen | last post by:
Hello, I find it annoying that one has to write self.assertEqual(x, y) rather than just assert x == y
0
2240
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): PERL5LIB=/Users/Ric/Library/Perl/ ls XML-Parser-2.34/ XML-Parser-2.34.tar
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.