Click here to Skip to main content
15,891,372 members
Home / Discussions / C#
   

C#

 
GeneralRe: 2 tables in 2 DataGridViews on a single form Pin
shivapriyak22-Apr-10 20:07
shivapriyak22-Apr-10 20:07 
GeneralRe: 2 tables in 2 DataGridViews on a single form Pin
sanforjackass22-Apr-10 21:42
sanforjackass22-Apr-10 21:42 
QuestionMemory Issue Pin
abcurl21-Apr-10 22:45
abcurl21-Apr-10 22:45 
AnswerRe: Memory Issue Pin
Ravi Bhavnani22-Apr-10 5:25
professionalRavi Bhavnani22-Apr-10 5:25 
QuestionProblem with image path of html files viewed by webbrowser control Pin
Royson Jacob21-Apr-10 22:43
Royson Jacob21-Apr-10 22:43 
AnswerRe: Problem with image path of html files viewed by webbrowser control Pin
Eddy Vluggen22-Apr-10 1:30
professionalEddy Vluggen22-Apr-10 1:30 
AnswerRe: Problem with image path of html files viewed by webbrowser control Pin
Luc Pattyn22-Apr-10 1:41
sitebuilderLuc Pattyn22-Apr-10 1:41 
QuestionModifying a node in XML Pin
NarVish21-Apr-10 22:38
NarVish21-Apr-10 22:38 
Hi,
I would like to modify the below xml where AssetClass name="CDS" and fieldType id= SECURITY. The below code is throwing exception at root.ReplaceChild... line "The node to be removed is not a child of this node.". Please correct it.. Thanks in advance.

 <?xml version="1.0" encoding="windows-1251" ?> 
 <MSGTaggingConfig version="1.0">
 <AssetClassConfiguration>
 <GlobalTypes>
  <FieldType id="F_TICKER" name="Ticker/Alias" color="#FF6600" type="S" output="false" description="Ticker Description" /> 
  <FieldType id="F_COUPON" name="Coupan/Alias" color="#FF3300" type="S" output="false" description="Ticker Description" /> 
  <FieldType id="F_BID" name="Bid Price" color="#FF9900" type="S" output="false" description="Bid Price Description" /> 
  <FieldType id="F_ASK" name="Ask Price" color="#FFCC00" type="S" output="false" description="Ask Price Description" /> 
  <FieldType id="F_TRENOR" name="Trenor" color="#FFCC33" type="S" output="false" description="Trenor Description" /> 
  <FieldType id="F_MATURITY" name="Maturity" color="#FFCC66" type="S" output="false" description="Maturity Description" /> 
  <FieldType id="F_ASSETQUALIFIER" name="Asset Qualifier" color="#CC9933" type="S" output="false" description="Asset Qualifier Description" /> 
  </GlobalTypes>
 <AssetClass id="AC_CDS" name="CDS" description="CDS Asset Class Description">
  <FieldType id="SECURITY" name="Security" color="#CC9900" type="C" output="true" description="Security Description" /> 
  <FieldType id="F_New" name="New Name" color="#008040" type="S" output="True" description="New Desc" /> 
  <FieldType id="F_New" name="New Name" color="Green" type="S" output="True" description="New desc" /> 
  <FieldType id="F_New" name="New Name" color="#80FF00" type="S" output="True" description="New Description" /> 
  </AssetClass>
</AssetClassConfiguration>
  </MSGTaggingConfig>


string filePath = Application.StartupPath + "\\MSGTaggingBackUp.xml";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(filePath);
string xpath = string.Format("/MSGTaggingConfig/AssetClassConfiguration/AssetClass");
XmlNodeList fieldNodes = xmlDoc.SelectNodes(xpath);
XmlNode studentNode = null;
XmlNode refNode = null;

foreach (XmlNode node in fieldNodes)
{
if (node.Attributes["name"].Value == "CDS")
{
for (int i = 0; i < node.ChildNodes.Count; i++)
{
if (node.ChildNodes[i].Attributes["id"].Value.ToString() == "Security")
{
studentNode = node.ChildNode[i]; break;
}
}
}
if (studentNode != null)
break;
}
XmlElement root = xmlDoc.DocumentElement;
XmlElement newCd = xmlDoc.CreateElement("FieldType");
newCd.SetAttribute("id", drChangedNode["id"].ToString());
newCd.SetAttribute("name", drChangedNode["name"].ToString());
newCd.SetAttribute("color", drChangedNode["color"].ToString());
newCd.SetAttribute("type", drChangedNode["type"].ToString());
newCd.SetAttribute("output", drChangedNode["output"].ToString());
newCd.SetAttribute("description", drChangedNode["description"].ToString());
root.ReplaceChild(newCd, studentNode);
xmlDoc.Save(filePath);
AnswerRe: Modifying a node in XML Pin
Estys22-Apr-10 0:27
Estys22-Apr-10 0:27 
GeneralRe: Modifying a node in XML Pin
NarVish22-Apr-10 1:35
NarVish22-Apr-10 1:35 
GeneralRe: Modifying a node in XML Pin
Estys22-Apr-10 2:29
Estys22-Apr-10 2:29 
GeneralRe: Modifying a node in XML Pin
NarVish22-Apr-10 2:39
NarVish22-Apr-10 2:39 
QuestionValue change of Entity in a ObservableCollection<T> Pin
Saiyed Alam21-Apr-10 22:32
Saiyed Alam21-Apr-10 22:32 
QuestionHow to fetch file from a folder within.the application Pin
NetMan201221-Apr-10 22:28
NetMan201221-Apr-10 22:28 
AnswerRe: How to fetch file from a folder within.the application Pin
Ice_Freez0521-Apr-10 22:45
Ice_Freez0521-Apr-10 22:45 
GeneralRe: How to fetch file from a folder within.the application Pin
NetMan201221-Apr-10 23:04
NetMan201221-Apr-10 23:04 
GeneralRe: How to fetch file from a folder within.the application Pin
Anindya Chatterjee21-Apr-10 23:14
Anindya Chatterjee21-Apr-10 23:14 
QuestionDataGridView Grouping Pin
Syed Shahid Hussain21-Apr-10 22:08
Syed Shahid Hussain21-Apr-10 22:08 
AnswerRe: DataGridView Grouping Pin
Eddy Vluggen22-Apr-10 1:34
professionalEddy Vluggen22-Apr-10 1:34 
QuestionExcel remains in memory Pin
KaurGurpreet21-Apr-10 21:28
KaurGurpreet21-Apr-10 21:28 
AnswerRe: Excel remains in memory Pin
m@u21-Apr-10 21:57
m@u21-Apr-10 21:57 
GeneralRe: Excel remains in memory Pin
KaurGurpreet21-Apr-10 22:32
KaurGurpreet21-Apr-10 22:32 
AnswerRe: Excel remains in memory Pin
Mirko198022-Apr-10 0:42
Mirko198022-Apr-10 0:42 
AnswerRe: Excel remains in memory Pin
Eddy Vluggen22-Apr-10 2:31
professionalEddy Vluggen22-Apr-10 2:31 
QuestionCompare two datarows Pin
NarVish21-Apr-10 21:15
NarVish21-Apr-10 21:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.