I am looking for an example on how to write an xml file to the sd card.
Thanks.
Robert
I am looking for an example on how to write an xml file to the sd card.
Thanks.
Robert
You need to do some searching on how XML is done on .NET. I will need many pages to explain it all. But since we added XML support to FEZ it make sense now to add examples to the free ebook.
Here is a simple example to make a simple XML file. You need to change the memory stream with file stream to write to a file…or take the buffer at the end and write it to a file.
public static void Main()
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.Ext.Xml.XmlWriter xmlwrite = System.Ext.Xml.XmlWriter.Create(ms);
xmlwrite.WriteComment("This is an XML example file");
xmlwrite.WriteProcessingInstruction("xml", "version='1.0', encoding='UTF-8'");
xmlwrite.WriteStartElement("Device");
xmlwrite.WriteString("FEZ");
xmlwrite.WriteEndElement();
xmlwrite.WriteStartElement("Type");
xmlwrite.WriteString("Domino");
xmlwrite.WriteEndElement();
xmlwrite.Flush();
xmlwrite.Close();
byte[] bb = ms.ToArray();
//char[] cc = System.Text.UTF8Encoding.UTF8.GetChars(bb);
char[] cc = System.Text.Encoding.UTF8.GetChars(bb);
string str = new string(cc);
Debug.Print(str);
}
Hi,
Thanks for the quick response. I am new to programming and just wrote my first application that uses xml recently. I used the assembly System.XML in my application.
In your sample it appears you are using an assembly with the name System.Ext.XML. I am having trouble locating that assembly.
Robert
Like I said before, you need to do some searching. If you did search and can’t find an answer then we are here ready to help
Let me google that for you, so I search google for “System.Ext.Xml”
http://www.LetMeGoogleThatForYou.com/?q=System.Ext.Xml
And this is the first hit
http://www.eggheadcafe.com/software/aspnet/35331897/where-is-xmltextwriter-an.aspx
Which shows that it is in the MFDpwsExtensions assembly.
Please see this http://www.tinyclr.com/forum/1/110/