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 BuildConfigurat ion SaveXML(XmlDocu ment xml, string fileName)
{
// Creates the nodelist
XmlNodeList nodeList;
XmlElement user = xml.DocumentEle ment;
nodeList = user.SelectNode s("//Build");
// Clear all the node
user.RemoveAll( );
xml.Save(fileNa me);
// Creates a new element for the build configuration
XmlElement xmlBuild = xml.CreateEleme nt("//Build");
xml.DocumentEle ment.AppendChil d(xmlBuild);
// Navigates to this node
xml.SelectSingl eNode("//Build");
xml.CreateAttri bute("type");
xml.CreateAttri bute("sync");
xml.CreateAttri bute("compile") ;
xml.CreateAttri bute("assemble" );
// Set the attribute values for the build configuration
xmlBuild.SetAtt ribute("type", BuildType);
xmlBuild.SetAtt ribute("sync", BuildSync.ToStr ing());
xmlBuild.SetAtt ribute("compile ", BuildCompile.To String());
xmlBuild.SetAtt ribute("assembl e", BuildAssemble.T oString());
// Navigates to this node
xml.SelectSingl eNode("//Build");
// Creates a new element for the sync configuration
XmlElement xmlSync = xml.CreateEleme nt("Sync");
xml.DocumentEle ment.AppendChil d(xmlSync);
xml.CreateAttri bute("version") ;
xml.CreateAttri bute("branch");
// Set the attribute values for the sync configuration
xmlSync.SetAttr ibute("version" , SyncVersion);
xmlSync.SetAttr ibute("branch", SyncBranch);
// Navigates to this node
xml.SelectSingl eNode("//Build/Sync");
// Creates a new element for the sync configuration
XmlElement xmlSyncDir = xml.CreateEleme nt("Directories ");
xml.DocumentEle ment.AppendChil d(xmlSync);
// Set the attribute values for the sync configuration
xmlSyncDir.SetA ttribute("baseP ath", SyncBasePath);
xml.Save(fileNa me);
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