4

We have a legacy code that uses MSXML2 with vb6 that works fine. Lately we converted the project to VB.NET and we are experiencing issues with the msxml when the xml getting big - basically it hung. After googling the issue we found this article that says The use of MSXML is not supported in .NET applications http://support.microsoft.com/kb/815112

I wonder if anyone know of a third party component that can imitate what msxml does but still can work with .NET . The other option is to rewrite those parts of code (using system.xml or linq) are very painful because the extensive use of MSXML in our application.

Thanks, Pini.

UshaP
  • 1,271
  • 2
  • 18
  • 32
  • what is the problem with use System.xml utilities? i theory that should be enough or what can't you do? – Carlos Cocom Jul 14 '11 at 14:22
  • @Carlos Cocom, I think the OP's issue is that a large portion of code would have to be re-written if they switched to `System.Xml` which is something that they'd like to avoid if possible. – Chris Haas Jul 14 '11 at 16:21
  • well if now have problems i think maybe its moment for refactoring because if well msxml not is obsolete the maker not have great support in that moment less further on. – Carlos Cocom Jul 15 '11 at 02:10
  • There is nothing obsolete or even deprecated about MSXML, which is a core part of Windows. As described in the Support article the O.P. linked to, .Net Interop is frought with hazards relating to threading and object lifetime. – Bob77 Jul 21 '11 at 06:14

2 Answers2

4

Unfortunately no, not that I've ever heard of. Microsoft does have another utility out there called XmlLite that sometimes sounds like it works with managed code but sometimes not. I've never tried it but its probably worth at least investigating. Otherwise your only options are to not upgrade to .Net or to migrate to managed XML. MS does have an article that might help you, HOW TO: Implement Common MSXML Tasks in System.xml By Using Visual C# .NET.

But if you do decide to re-write in managed, since you're using VB.Net I'd highly recommend looking into XML Literals. XML is insanely easy when using them.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Chris Haas
  • 53,986
  • 12
  • 141
  • 274
0

I don't have extensive experience updating from MSXML to System.XML, but so far I've found the two to be remarkably similar. That might be luck, if the footprint of MSXML my code was using just happened to be relatively small.

As far as it goes, Mobilize.NET published a guide mapping some common classes (not sure if it is 100% comprehensive) between the two, which I have found to be accurate:

+-------------------------------------+-------------------------------------+
|                Class                |               Maps To               |
+-------------------------------------+-------------------------------------+
| MSXML2.DOMDocument                  | System.Xml.XmlDocument              |
| MSXML2.DOMNodeType                  | System.Xml.XmlNodeType              |
| MSXML2.IXMLDOMAttribute             | System.Xml.XmlAttribute             |
| MSXML2.IXMLDOMCDATASection          | System.Xml.XmlCDataSection          |
| MSXML2.IXMLDOMDocument              | System.Xml.XmlDocument              |
| MSXML2.IXMLDOMElement               | System.Xml.XmlElement               |
| MSXML2.IXMLDOMNamedNodeMap          | System.Xml.XmlNamedNodeMap          |
| MSXML2.IXMLDOMNode                  | System.Xml.XmlNode                  |
| MSXML2.IXMLDOMNodeList              | System.Xml.XmlNodeList              |
| MSXML2.IXMLDOMParseError            | System.Exception                    |
| MSXML2.IXMLDOMText                  | System.Xml.XmlCharacterData         |
| MSXML2.tagDOMNodeType               | System.Xml.XmlNodeType              |
| MSXML2.IXMLDOMCharacterData         | System.Xml.XmlCharacterData         |
| MSXML2.IXMLDOMDocumentFragment      | System.Xml.XmlDocumentFragment      |
| MSXML2.IXMLDOMComment               | System.Xml.XmlComment               |
| MSXML2.IXMLDOMEntity                | System.Xml.XmlEntity                |
| MSXML2.IXMLDOMEntityReference       | System.Xml.XmlEntityReference       |
| MSXML2.IXMLDOMImplementation        | System.Xml.XmlImplementation        |
| MSXML2.IXMLDOMNotation              | System.Xml.XmlNotation              |
| MSXML2.IXMLDOMProcessingInstruction | System.Xml.XmlProcessingInstruction |
| MSXML2.IXMLDOMDocumentType          | System.Xml.XmlDocumentType          |
| MSXML2.FreeThreadedDOMDocument      | System.Xml.XmlDocument              |
| MSXML2.FreeThreadedDOMDocument40    | System.Xml.XmlDocument              |
| MSXML2.DOMDocument40                | System.Xml.XmlDocument              |
+-------------------------------------+-------------------------------------+

If you're very lucky you can just substitute old for new and run it.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81