loXmlDocument.InsertAfter(loXmlProcessingInstruction, loXmlDocument.FirstChild)But, when constructing the XML in memory, all I have is oMemoryStream. Does this mean I would have to dump the memory stream into a variable. Load that variable into loXmlDocument. Benefit from its InsertAfter() method. Once inserted, reinitialize oMemoryStream with an updated content. There has to be a way to manipulate something like directly from the oMemoryStream variable. Have you ever did something like this?