Neal Walters - Mostly Biztalk Blogs

Tuesday, May 16, 2006

Another bizarre error - hard to figure this one out (took about an hour).

System.InvalidOperationException: This document already has a DocumentElement node. at System.Xml.XmlDocument.IsValidChildType(XmlNodeType type) at System.Xml.XmlNode.AppendChild(XmlNode newChild) at Microsoft.XLANGs.Core.Part.XPathStore(Object rValue, String xpath)

I was doing something like this in a Biztalk Message Assignment shape (after a map, in a construct block):

xpath(msgAbc,
"//*[./@VarName = 'gWorkflowProcessID']/*[local-name()='VarValue']")
= guidWorkflowProcessId;

the correction was to add "ToString()" on the end of the GUID variable.
I'm kind of surprised the above even compiled.

xpath(msgAbc,
"//*[./@VarName = 'gWorkflowProcessID']/*[local-name()='VarValue']")
= guidWorkflowProcessId.ToString();