Try using the system.IO.Packaging namespace
Quick example for replacing the Data with a data.xml file
//Load in the XML
XmlDataDocument myXmlDocument = new XmlDataDocument();
myXmlDocument.Load(dataPath + "\\data.xml");
//Open the File using the packaging API
using (Package p = Package.Open(createdDocPath, FileMode.Open, FileAccess.ReadWrite))
{
Uri partUri = new Uri("/CustomXml/item1.xml", UriKind.Relative);
PackagePart part = p.GetPart(partUri);
//Overwrite the part with the new XML
using (Stream s = part.GetStream(FileMode.Create))
{
myXmlDocument.Save(s);
}
p.Flush();
}