What is the .NET 4.6 equivalent of VB6 MSXML2 nodeTypedValue?

Viewed 1003

I have been tasked with upgrading an ancient application that was written in VB6 to VB.NET/.NET Framework 4.6. The program does quite a bit of XML parsing, most of which I have been able to convert to using the System.Xml library however I can't seem to figure out how to handle typed node values. The following appears all over the code:

' VB6
Dim xmlNode As MSXML2.IXMLDOMElement
...
iNodeValue = xmlNode.nodeTypedValue
...
xmlNode.nodeTypedValue = iNodeValue

I have figured out how to get a node's typed value via XPathNavigator, however, I can't seem to figure out how to assign the value of a typed node. I wasn't able to turn up much on this topic online, but my google-fu is weak. Can anyone suggest how I might go about doing this or offer an alternative? Any help would be greatly appreciated.

1 Answers

To anyone wondering about this, in order to resolve my issue, I ended up using the XmlDocument class to get the node's value from the XML, and then converted the string value to the datatype needed. For example,

string sValue = xmlDoc.SelectSingleNode("//testint").InnerText
int iValue = Integer.Parse(sValue)

Integer.TryParse() would also be a great option if you are concerned about the data that may be retrieved.

Related