MSXML GetHashCode
Does anyone know how to get a unique identifier for an IXMLNode for MSXML? I’ve tried googling around for this without finding a solution. In Mozilla I can just use expando properties but expandos do not work when using ActiveX objects.
I think I’ll probably have to use an array and then use the index in the array as the hash code but that will make it O(n) and that would totally suck for something as common as this.
April 27th, 2004 at 19:53
There’s a function to do this called - ironically enough - uniqueid(). witness:
http://msdn.microsoft.com/library/en-us/xmlsdk30/htm/xmmthuniqueid.asp
I’m trying to figure out how to get at it through old school msxml, let you know what I find.
–
Aaron
April 27th, 2004 at 20:11
Yeah, there is probably a way better way to get at that IXTLRuntime object that I can’t find right now, but you could always do something horrific like this:
var source = new ActiveXObject(”Msxml2.DOMDocument”);
source.async = false;
source.resolveExternals = false;
source.loadXML(”<foo><bar/></foo>”);
// Load style sheet.
var stylesheet = new ActiveXObject(”Msxml2.DOMDocument”);
stylesheet.async = false;
stylesheet.resolveExternals = false;
stylesheet.loadXML(’<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” version=”1.0″>’ +
‘<xsl:output omit-xml-declaration=”yes” />’ +
‘<xsl:template match=”*”><xsl:value-of select=”generate-id(.)” /></xsl:template>’ +
‘</xsl:stylesheet>’);
// Fill a div tag with the result of the transform
alert(source.transformNode(stylesheet));
November 14th, 2004 at 21:33
Explorer will always be the best browser. Don”t you dare install Firefox or we will sue you.
IE Team