The following is a high-level summary of features new to MSXML that were introduced with MSXML 4.0.
-
Support for XML Schemas (XSD)
MSXML 4.0 provides extensive support for the final World Wide Web Consortium (W3C) XML Schema (XSD) Recommendation. For example, you can validate XML data and documents against XML schemas (XSD) using either DOM or SAX programming models through the use of either external schema cache or through the xsi:schemaLocation or xsi:noNamespaceSchemaLocation attributes. Although MSXML 4.0 does not support XPath 2.0, MSXML 4.0 provides extension functions, permitted by standards, to support handling XSD types in XPath and XSLT.
For more information, see XML Schemas (XSD) Reference.
-
Support for the Schema Object Model (SOM)
MSXML 4.0 also provides a way to reach schema information in validated documents using type discovery in SAX and the Schema Object Model (SOM) in DOM. In addition to this added support for the final XML Schema recommendation, MSXML continues to support XML-Data Reduced (XDR) and document type definition (DTD) validations.
For more information, see the SOM section.
-
Side-by-Side Functionality
MSXML 4.0 supports Windows Side-by-Side (SxS) installation under Windows XP or Windows Server 2003. This means that when you install MSXML 4.0 under these qualified versions of Microsoft Windows, you have side-by-side access to other versions of MSXML. Potentially, SxS installation can also include support for running multiple released versions of MSXML 4.0 side by side under Windows. To do so, you will have to create a special application manifest, which will link your application to the specific version of MSXML 4.0. If you want to use MSXML in the same way as before, you don't have to do anything; MSXML installs in both global (as before) and side-by-side (new) mode on Windows XP and Windows Server 2003.
For more information, see MSXML and Windows.
-
Removal of Support for Replace Mode Installations
Before MSXML 4.0, you could use replace mode to make the latest MSXML component simulate MSXML 2.0, which Internet Explorer 5.0 and 5.5 used for presenting XML when browsing. In some cases, a special utility, xmlinst.exe, manipulated the Microsoft Windows registry to achieve this effect.
With MSXML 4.0, replace mode is no longer supported or required. MSXML 4.0 does not replace earlier versions of MSXML and cannot be used to substitute MSXML 2.0 for Internet Explorer. That means that if Internet Explorer is your default program to open XML files, and you double click on an XML document, Internet Explorer will not use MSXML 4.0 to show it.
You can however, still programmatically call and use MSXML 4.0 as was possible with earlier versions of MSXML so that it is used to manipulate XML within an HTML page using script.
For more information, see Initiate XSLT in a Script.
-
Version-Independent ProgIDs Removed
Version-independent ProgIDs were available in MSMXL and earlier releases and appeared such as the following when used in JScript code:
var xmldoc = CreateActiveXObject("MSXML2.DOMDocument")
or in Visual Basic code as:
Dim xmldoc As New MSXML2.DOMDocument
These types of version-independent ProgIDs are now removed with MSXML 4.0 and later versions. This guarantees that MSXML 4.0 and later versions of MSXML will not interfere with any versions of MSXML (2.0, 2.6, or 3.0) previously installed.
If you use the previous examples in your code, you will not instantiate the MSXML 4.0 DOM, but instead the prior replace-mode versions of the MSXML parser (MSXML 3.0 or earlier depending on the version of Windows or other installed applications on the system that use MSXML).
If you want to use MSXML 4.0, you must create a DOMDocument object in JScript like this:
var xmldoc = CreateActiveXObject("MSXML2.DOMDocument.4.0")
Accordingly, for C++ and Microsoft Visual Basic you will create "MSXML2.DOMDocument40". Similar changes will be necessary with all other MSXML objects in order to use the MSXML 4.0 version.
So why was this support removed in MSXML 4.0 and later versions? The primary reason for this change was to improve the maintainability of MSXML-based code, which otherwise was highly error-prone when unexpected changes occurred in the environment. In actual field experience when deploying and supporting XML applications, version-independent ProgIDs were very convenient for a developer wishing to try out MSXML with little or no code change, but very risky for code running in production environments.
For example, many were able to develop code that used the version-independent ProgIDs, and expect a specific version of MSXML 3.0 to be in place. If for any reason a system was later updated by a user, such as to install (or reinstall) Microsoft SQL Server 2000, they might unexpectedly find that they were using MSXML 2.6 instead of MSXML 3.0. Removing version-independent ProgIDs in MSXML 4.0 eliminates such instability, and improves MSXML as a server-side enterprise-grade component.
-
Extended Support for Sequential XML Processing Architectures
The ServerXMLHTTPRequest object, which was introduced in MSXML 3.0, provided reliable server-side HTTP access independent of WinInet. This server-side HTTP stack functionality is now included with the new WinHTTP 5.0 component, which is shipped and installed with MSXML 4.0. ServerXMLHTTPRequest provides only the front end to this component.
MSXML 4.0 provides extended support for sequential XML processing architectures based on the SAX2 API. This includes:
-
Integration between the DOM and SAX parsing models
-
Ability to generate HTML output
-
Ability to plug the SAX content handler to the output of the XSLT processor
-
Tracking of namespace declarations
You can now use the MXXMLWriter object to generate SAX events from a DOM tree. You can likewise build a DOM tree out of SAX events. This feature allows you to closely integrate DOM and SAX in your applications.
A new object, MXHTMLWriter, enables you to output HTML using a stream of SAX events in much the same way that the <xsl:output> element in XSLT can generate HTML from a result tree. The new MXHTMLWriter object provides necessary support for high-performing Active Server Pages (ASP), which read XML documents with a SAX reader, put those documents through custom SAX filters, and output the data to the user as an HTML page. The MXHTMLWriter object is also useful for a number of other applications, like the manual generation of HTML pages.
The XSLT processor can now accept the SAX content handler as output. This means that the chain of SAX filters can directly process the transformed XML. For example, you can use this feature to eliminate XML regeneration and reparsing, allowing XML documents to be consumed immediately by an application when incoming XML documents need to be translated to the same dictionary.
The new MXNamespaceManager object allows you to manually track namespace declarations and resolve them, either in the current context or in the context of a particular DOM node. Although MSXML supports namespaces, and can automatically resolve names of elements and attributes, there are more and more cases in which an attribute's value or an element's content uses qualified names. The new MXNamespaceManager object is readily able to track and resolve these qualified names.
-
Removal of Legacy Code
A number of legacy features have been dropped from this release. Most of these are features that are no longer necessary because of replace mode. The eliminated features include:
-
Old, non-conformant XSL, which is now replaced completely with W3 standard XSLT 1.0. Complete XSLT 1.0 has been available since MSXML 3.0.
-
Old, non-conformant XSLPattern language, which is now replaced completely with W3 standard XPath 1.0. Complete XPath 1.0 has been available since MSXML 3.0.
-
Old, non-conformant XDR rudimentary uuid: namespaces. Correct namespace for old XDR support are now the HTTP-based namespaces: urn:schemas-microsoft-com:xml-data and urn:schemas-microsoft-com:datatypes.
-
The old, non-standard NodeFactory interface, which was deprecated in MSXML 3.0. This interface was used for XML sequential parsing. It has been replaced completely with the SAX2 parser, which has been available since MSXML 3.0.
-
The normalize-line-break feature now has no effect with the SAX parser. Line breaks are always normalized per XML specifications.
-
Separate WinHTTP Version 5.0 Component
The functionality of the ServerHTTPRequest component is now provided by a separate WinHTTP component. This is a new server-side component that provides reliable HTTP stack functionality. Without the WinHTTP component, ServerHTTPRequest and DOM/SAX with server-side mode will not be able to access HTTP-based data. When you install MSXML 4.0 on a computer running Windows NT/2000/XP OS, you automatically install the WinHTTP component. However, this is not true for Windows 98/Me, on which WinHTTP does not work. You can still install MSXML on Windows 98 or Windows Me, but you will have to use the default DOM/SAX mode, or the XMLHTTPRequest object for HTTP functionality, which uses the WinInet component. The WinInet component is preinstalled on these versions of Windows with Internet Explorer.
This release provides the slimmer, faster, and more conformant XML processing components, which can be used safely in a server-side environment of enterprise-grade systems. MSXML 4.0 can still be successfully used on the client side with a controlled environment when you can ensure installation of the component you want on the client computer, as in cases with non-thin clients.
-
Substantial Improvements in XSLT Performance
MSXML 4.0 provides a substantially faster XSLT engine than the one that was provided in MSXML 3.0. Internal testing by the MSXML team indicated that XSLT transformations performed using MSXML 4.0 were in the range of four to eight times faster than when those same transformations were performed using MSXML 3.0. MSXML 4.0 also provides a new DOM parser that provides stability and accelerated performance in contrast to the original MSXML parser, although you can decide which parser to use in your code. For more information, see NewParser Property.
-
MSXML Name Change
With MSXML 4.0, the full unabbreviated name of MSXML has changed. Originally, MSXML was a component to provide XML parsing, so the complete name was Microsoft XML Parser. Over the years, however, both XML and MSXML have grown. MSXML now provides far more functionality than just parsing. With MSXML 4.0, the new full name, Microsoft XML Core Services, reflects the new functionality that MSXML now provides for XML programming. Note that the abbreviated name is the still the same as before: MSXML.