EDN Admin
Well-known member
Hi, Im trying to create a xml file like this:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; Categories<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Categories<span style="color:Blue; >
[/code]
I wrote these codes in my XmlBuilder C# class:
<div style="color:Black;background-color:White; <pre>
XmlDocument myDoc = <span style="color:Blue; new XmlDocument();
XmlElement myRoot = myDoc.CreateElement(<span style="color:#A31515; "Categories");
XmlElement mySubLevel1 = myDoc.CreateElement(<span style="color:#A31515; "SubLevel1");
<span style="color:Blue; public <span style="color:Blue; void RootBuilder()
{
<span style="color:Green; //Add Root Element
myDoc.AppendChild(myRoot);
}
<span style="color:Blue; public <span style="color:Blue; void CategoryBuilder(<span style="color:Blue; string ID, <span style="color:Blue; string Name, <span style="color:Blue; string ImageUrl, <span style="color:Blue; string IsEmpty)
{
<span style="color:Green; //Add Category Element
myCategory.SetAttribute(<span style="color:#A31515; "ID", ID);
myCategory.SetAttribute(<span style="color:#A31515; "Name", Name);
myCategory.SetAttribute(<span style="color:#A31515; "ImageUrl", ImageUrl);
myCategory.SetAttribute(<span style="color:#A31515; "IsEmpty", IsEmpty);
myRoot.AppendChild(myCategory);
}
<span style="color:Blue; public <span style="color:Blue; void SubLevel_1Builder(<span style="color:Blue; string ID, <span style="color:Blue; string Name, <span style="color:Blue; string ImageUrl, <span style="color:Blue; string IsEmpty)
{
<span style="color:Green; //Add SubLevel1 Element
mySubLevel1.SetAttribute(<span style="color:#A31515; "ID", ID);
mySubLevel1.SetAttribute(<span style="color:#A31515; "Name", Name);
mySubLevel1.SetAttribute(<span style="color:#A31515; "ImageUrl", ImageUrl);
mySubLevel1.SetAttribute(<span style="color:#A31515; "IsEmpty", IsEmpty);
myCategory.AppendChild(mySubLevel1);
}<br/><span style="color:Blue; public <span style="color:Blue; void XmlSaver()<br/> {<br/> <span style="color:Green; //Save Nodes in a Xml File<br/> myDoc.Save("myDB.xml");<br/> }
[/code]
I wrote these codes in my Button Click event:
<div style="color:Black;background-color:White; <pre>
myXmlBuilder myClass = <span style="color:Blue; new myXmlBuilder();
myClass.RootBuilder();
<span style="color:Blue; for (<span style="color:Blue; int i = 0; i < 5; i++)
{
myClass.CategoryBuilder(<span style="color:#A31515; "ID", <span style="color:#A31515; "Name", <span style="color:#A31515; "ImageUrl", <span style="color:#A31515; "IsEmpty");
<span style="color:Blue; for (<span style="color:Blue; int j = 0; j < 5; j++)
{
myClass.SubLevel_1Builder(j.ToString(), <span style="color:#A31515; "Name", <span style="color:#A31515; "ImageUrl", <span style="color:#A31515; "IsEmpty");
}
}
myClass.XmlSaver();
[/code]
The problem is when I press Button the there is just one Category & SubLevel1.
Why For block doesnt work?
View the full article
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; Categories<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; Category <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ID<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; <<span style="color:#A31515; SubLevel1 <span style="color:Red; ID<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; " <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Name<span style="color:Black; " <span style="color:Red; ImageUrl<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ImageUrl<span style="color:Black; " <span style="color:Red; IsEmpty<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; IsEmpty<span style="color:Black; " <span style="color:Blue; /><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Category<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; br<span style="color:Blue; /> <span style="color:Blue; </<span style="color:#A31515; Categories<span style="color:Blue; >
[/code]
I wrote these codes in my XmlBuilder C# class:
<div style="color:Black;background-color:White; <pre>
XmlDocument myDoc = <span style="color:Blue; new XmlDocument();
XmlElement myRoot = myDoc.CreateElement(<span style="color:#A31515; "Categories");
XmlElement mySubLevel1 = myDoc.CreateElement(<span style="color:#A31515; "SubLevel1");
<span style="color:Blue; public <span style="color:Blue; void RootBuilder()
{
<span style="color:Green; //Add Root Element
myDoc.AppendChild(myRoot);
}
<span style="color:Blue; public <span style="color:Blue; void CategoryBuilder(<span style="color:Blue; string ID, <span style="color:Blue; string Name, <span style="color:Blue; string ImageUrl, <span style="color:Blue; string IsEmpty)
{
<span style="color:Green; //Add Category Element
myCategory.SetAttribute(<span style="color:#A31515; "ID", ID);
myCategory.SetAttribute(<span style="color:#A31515; "Name", Name);
myCategory.SetAttribute(<span style="color:#A31515; "ImageUrl", ImageUrl);
myCategory.SetAttribute(<span style="color:#A31515; "IsEmpty", IsEmpty);
myRoot.AppendChild(myCategory);
}
<span style="color:Blue; public <span style="color:Blue; void SubLevel_1Builder(<span style="color:Blue; string ID, <span style="color:Blue; string Name, <span style="color:Blue; string ImageUrl, <span style="color:Blue; string IsEmpty)
{
<span style="color:Green; //Add SubLevel1 Element
mySubLevel1.SetAttribute(<span style="color:#A31515; "ID", ID);
mySubLevel1.SetAttribute(<span style="color:#A31515; "Name", Name);
mySubLevel1.SetAttribute(<span style="color:#A31515; "ImageUrl", ImageUrl);
mySubLevel1.SetAttribute(<span style="color:#A31515; "IsEmpty", IsEmpty);
myCategory.AppendChild(mySubLevel1);
}<br/><span style="color:Blue; public <span style="color:Blue; void XmlSaver()<br/> {<br/> <span style="color:Green; //Save Nodes in a Xml File<br/> myDoc.Save("myDB.xml");<br/> }
[/code]
I wrote these codes in my Button Click event:
<div style="color:Black;background-color:White; <pre>
myXmlBuilder myClass = <span style="color:Blue; new myXmlBuilder();
myClass.RootBuilder();
<span style="color:Blue; for (<span style="color:Blue; int i = 0; i < 5; i++)
{
myClass.CategoryBuilder(<span style="color:#A31515; "ID", <span style="color:#A31515; "Name", <span style="color:#A31515; "ImageUrl", <span style="color:#A31515; "IsEmpty");
<span style="color:Blue; for (<span style="color:Blue; int j = 0; j < 5; j++)
{
myClass.SubLevel_1Builder(j.ToString(), <span style="color:#A31515; "Name", <span style="color:#A31515; "ImageUrl", <span style="color:#A31515; "IsEmpty");
}
}
myClass.XmlSaver();
[/code]
The problem is when I press Button the there is just one Category & SubLevel1.
Why For block doesnt work?
View the full article