C# XML Atribute help? [modified]
-
Hi . I have xml file .
XmlWriter writer = XmlWriter.Create(path + "\\playbackmanu.xml");
writer.WriteStartDocument();
writer.WriteStartElement("PlayBack");for(int i=1;i<=nCount;i++)
{
writer.WriteStartElement("ItemInfo");
writer.WriteElementString("itemimgpath","img"+ i.ToString() + ".jpg");
writer.WriteElementString("itemname", "");
writer.WriteElementString("itemtitle", "Title "+i.ToString());
writer.WriteElementString("itemcommand",i.ToString());
writer.WriteEndElement();
}writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
#PlayBack#
#ItemInfo#
#itemimgpath#img1.jpg#/itemimgpath#
#itemname##/itemname#
#itemtitle#Title 1#/itemtitle#
#itemcommand#1#/itemcommand#
#/ItemInfo##ItemInfo# #itemimgpath#img2.jpg#/itemimgpath# #itemname##/itemname# #itemtitle#Title 2#/itemtitle# #itemcommand#2#/itemcommand# #/ItemInfo#
#/PlayBack#
is < and >
How i can add atribute first node ? #PlayBack testAtribute="Hello world"# Thanks.
We are haven't bug,just temporarily undecided problems.
modified on Wednesday, April 14, 2010 6:24 AM
-
Hi . I have xml file .
XmlWriter writer = XmlWriter.Create(path + "\\playbackmanu.xml");
writer.WriteStartDocument();
writer.WriteStartElement("PlayBack");for(int i=1;i<=nCount;i++)
{
writer.WriteStartElement("ItemInfo");
writer.WriteElementString("itemimgpath","img"+ i.ToString() + ".jpg");
writer.WriteElementString("itemname", "");
writer.WriteElementString("itemtitle", "Title "+i.ToString());
writer.WriteElementString("itemcommand",i.ToString());
writer.WriteEndElement();
}writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
#PlayBack#
#ItemInfo#
#itemimgpath#img1.jpg#/itemimgpath#
#itemname##/itemname#
#itemtitle#Title 1#/itemtitle#
#itemcommand#1#/itemcommand#
#/ItemInfo##ItemInfo# #itemimgpath#img2.jpg#/itemimgpath# #itemname##/itemname# #itemtitle#Title 2#/itemtitle# #itemcommand#2#/itemcommand# #/ItemInfo#
#/PlayBack#
is < and >
How i can add atribute first node ? #PlayBack testAtribute="Hello world"# Thanks.
We are haven't bug,just temporarily undecided problems.
modified on Wednesday, April 14, 2010 6:24 AM
-
Hi . I have xml file .
XmlWriter writer = XmlWriter.Create(path + "\\playbackmanu.xml");
writer.WriteStartDocument();
writer.WriteStartElement("PlayBack");for(int i=1;i<=nCount;i++)
{
writer.WriteStartElement("ItemInfo");
writer.WriteElementString("itemimgpath","img"+ i.ToString() + ".jpg");
writer.WriteElementString("itemname", "");
writer.WriteElementString("itemtitle", "Title "+i.ToString());
writer.WriteElementString("itemcommand",i.ToString());
writer.WriteEndElement();
}writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
#PlayBack#
#ItemInfo#
#itemimgpath#img1.jpg#/itemimgpath#
#itemname##/itemname#
#itemtitle#Title 1#/itemtitle#
#itemcommand#1#/itemcommand#
#/ItemInfo##ItemInfo# #itemimgpath#img2.jpg#/itemimgpath# #itemname##/itemname# #itemtitle#Title 2#/itemtitle# #itemcommand#2#/itemcommand# #/ItemInfo#
#/PlayBack#
is < and >
How i can add atribute first node ? #PlayBack testAtribute="Hello world"# Thanks.
We are haven't bug,just temporarily undecided problems.
modified on Wednesday, April 14, 2010 6:24 AM
Did reading the documentation for XmlWriter not strike you as an idea? http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writeattributes.aspx[^] edit: This one is probably a better link[^]
-
Hi . I have xml file .
XmlWriter writer = XmlWriter.Create(path + "\\playbackmanu.xml");
writer.WriteStartDocument();
writer.WriteStartElement("PlayBack");for(int i=1;i<=nCount;i++)
{
writer.WriteStartElement("ItemInfo");
writer.WriteElementString("itemimgpath","img"+ i.ToString() + ".jpg");
writer.WriteElementString("itemname", "");
writer.WriteElementString("itemtitle", "Title "+i.ToString());
writer.WriteElementString("itemcommand",i.ToString());
writer.WriteEndElement();
}writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
#PlayBack#
#ItemInfo#
#itemimgpath#img1.jpg#/itemimgpath#
#itemname##/itemname#
#itemtitle#Title 1#/itemtitle#
#itemcommand#1#/itemcommand#
#/ItemInfo##ItemInfo# #itemimgpath#img2.jpg#/itemimgpath# #itemname##/itemname# #itemtitle#Title 2#/itemtitle# #itemcommand#2#/itemcommand# #/ItemInfo#
#/PlayBack#
is < and >
How i can add atribute first node ? #PlayBack testAtribute="Hello world"# Thanks.
We are haven't bug,just temporarily undecided problems.
modified on Wednesday, April 14, 2010 6:24 AM
:rose::rose:
We are haven't bug,just temporarily undecided problems.
-
:rose::rose:
We are haven't bug,just temporarily undecided problems.
-
Hi . I have xml file .
XmlWriter writer = XmlWriter.Create(path + "\\playbackmanu.xml");
writer.WriteStartDocument();
writer.WriteStartElement("PlayBack");for(int i=1;i<=nCount;i++)
{
writer.WriteStartElement("ItemInfo");
writer.WriteElementString("itemimgpath","img"+ i.ToString() + ".jpg");
writer.WriteElementString("itemname", "");
writer.WriteElementString("itemtitle", "Title "+i.ToString());
writer.WriteElementString("itemcommand",i.ToString());
writer.WriteEndElement();
}writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
#PlayBack#
#ItemInfo#
#itemimgpath#img1.jpg#/itemimgpath#
#itemname##/itemname#
#itemtitle#Title 1#/itemtitle#
#itemcommand#1#/itemcommand#
#/ItemInfo##ItemInfo# #itemimgpath#img2.jpg#/itemimgpath# #itemname##/itemname# #itemtitle#Title 2#/itemtitle# #itemcommand#2#/itemcommand# #/ItemInfo#
#/PlayBack#
is < and >
How i can add atribute first node ? #PlayBack testAtribute="Hello world"# Thanks.
We are haven't bug,just temporarily undecided problems.
modified on Wednesday, April 14, 2010 6:24 AM