MSXML: A Developer's Perspective
In this column, Bruce Russell shares some of his observations about Microsoft XML Parser (MSXML).
January 29, 2001
Recently, I've spent a lot of time with the Microsoft XML Parser (MSXML). In this column, I share some of my observations about it. Version 3.0 has been stable and reliable, and Microsoft has updated it to be compatible with the latest World Wide Web Consortium (W3C) standards. MSXML has versatile and useful features that you can use in many different ways.
You use MSXML to instantiate an XML Document Object Model (DOM) object. One technique developers use heavily is to load an XML document into one DOM and an Extensible Style Language Transformations (XSLT) document into another DOM and use the transformNode method to apply the stylesheet. By modifying the DOM objects before the transform, you can create some dynamic effects. For example, you can create an extra node in the XML DOM and set attributes to pass to the XSLT DOM. Add logic in the XSLT to create different output based on those parameters. Or you can set a sort node in the XSLT to change the sort order of the output on the fly. I've used this technique to create some cool effects with little code.
You can install MSXML on both the server and the Microsoft Internet Explorer (IE) client, which means that code you develop for a server application can also run on the client. In addition, the methods and properties are the same among languages. I'm developing with JScript on the client and VBScript on the server; the code is almost the same, so I don't have to remember different calls in each arena.
Another great MSXML feature is the XMLHTTP object, which you can use to make calls to the backend server without leaving the page. I use XMLHTTP to do searches, validate input, and update the database—all from one form. I spend less time trying to figure out creative page recursion tricks and can concentrate on building a functional application.
MSXML is great, once you get it installed, and installation isn't that difficult. The MSXML install itself is a straightforward wizard install, but to really get the greatest use out of the parser, you need to run xmlinst.exe. Basically, this program sets the latest version parser as the default for all your Microsoft programs, including IE. The Microsoft site has all the details.
The major drawback, of course, is that MSXML is Microsoft specific. If IIS and IE are your Web server and client of choice, then MSXML is a great way to develop a Web application.
Let me mention one gotcha. Different versions of MSXML aren't 100 percent compatible with each other. For example, the latest XSLT syntax isn't compatible with older versions. Stylesheets written to the older standard might return an error or blank output. Pick a version and go with it. Use the xmlinst utility to force youself to revise your XML and XSLT to the latest standard.
About the Author
You May Also Like