Hi all!
I'm trying to create this XML file:
<?xml version="1.0" encoding="utf-8" ?>
<Build type="Daily" sync="True" compile="True" assemble="True" >
<Sync version="1.0.0.0" branch="QA">
<Directories basePath="//OpicsPlus/Source/Release" />
</Sync>
</Build>
For this, I'm trying to use the code below:
private static BuildConfiguration SaveXML(XmlDocument xml, string fileName)
{
// Creates the nodelist
XmlNodeList nodeList;
XmlElement user = xml.DocumentElement;
nodeList = user.SelectNodes("//Build");
// Clear all the node
user.RemoveAll();
xml.Save(fileName);
// Creates a new element for the build configuration
XmlElement xmlBuild = xml.CreateElement("//Build");
xml.DocumentElement.AppendChild(xmlBuild);
// Navigates to this node
xml.SelectSingleNode("//Build");
xml.CreateAttribute("type");
xml.CreateAttribute("sync");
xml.CreateAttribute("compile");
xml.CreateAttribute("assemble");
// Set the attribute values for the build configuration
xmlBuild.SetAttribute("type", BuildType);
xmlBuild.SetAttribute("sync", BuildSync.ToString());
xmlBuild.SetAttribute("compile", BuildCompile.ToString());
xmlBuild.SetAttribute("assemble", BuildAssemble.ToString());
// Navigates to this node
xml.SelectSingleNode("//Build");
// Creates a new element for the sync configuration
XmlElement xmlSync = xml.CreateElement("Sync");
xml.DocumentElement.AppendChild(xmlSync);
xml.CreateAttribute("version");
xml.CreateAttribute("branch");
// Set the attribute values for the sync configuration
xmlSync.SetAttribute("version", SyncVersion);
xmlSync.SetAttribute("branch", SyncBranch);
// Navigates to this node
xml.SelectSingleNode("//Build/Sync");
// Creates a new element for the sync configuration
XmlElement xmlSyncDir = xml.CreateElement("Directories");
xml.DocumentElement.AppendChild(xmlSync);
// Set the attribute values for the sync configuration
xmlSyncDir.SetAttribute("basePath", SyncBasePath);
xml.Save(fileName);
return null;
}
But it's creating like this:
<Build>
<Build type="Daily" sync="True" compile="True" assemble="True" >
<Sync version="1.0.0.0" branch="QA">
<Directories basePath="//OpicsPlus/Source/Release" />
</Sync>
</Build>
</Build>
Anybody knows how can I remove everything and start from scratch ?
Thanks!
Eduardo
--
Eduardo de Morais Ferrari
Misys OPICS Project
Stefanini IT Solutions
White Plains, NY
Phone: (914) 821-2727
Cell: (914) 406-5027
ed*************@misys.com