Xml Reader
#1
Posted 22 December 2010 - 04:08 AM
#2
Posted 22 December 2010 - 08:44 AM
#3
Posted 22 December 2010 - 02:16 PM
#4
Posted 22 December 2010 - 02:36 PM
Hm, I don't think you can rely on emulator for such tests - emulator included in .NET Micro Framework is just a port onto Windows platform, you will get a lot of "not supported" exceptions when the code developed on emulator runs on another hardware board (like Netduino), where features are not implemented or supported; and vice versa the emulator does not implement every hardware interface available on the hardware boards. You'd need a board-specific emulator, something like Netduino Emulator (work in progress) and also emulated peripherals to get reference environment.The netmf can run off emulators so you don't even need a Netduino, to test it.
#5
Posted 23 December 2010 - 04:06 AM
The system.xml class does not appear to have any options that can return attributes of an xml element. If no options exist, what's the alternative?
System.Xml is a namespace, not a class
Hello,
I'm trying to find a way to read/grab attributes from xml. Is the XmlReader class from the System.Xml namespace available? If not, does an alternative exist?
XmlReader is available:
http://msdn.microsof...y/ee437375.aspx
#6
Posted 23 December 2010 - 05:52 AM
#7
Posted 24 December 2010 - 06:40 AM
The thread '<No Name>' (0x2) has exited with code 0 (0x0). #### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) #### #### Message: #### System.Xml.XmlReader::Create [IP: 00c7] #### #### System.Xml.XmlReader::Create [IP: 0005] #### #### NetduinoApplication1.StorageData::XmlFromStorage [IP: 0020] #### #### NetduinoApplication1.Program::Main [IP: 0009] #### A first chance exception of type 'System.NotSupportedException' occurred in System.Xml.dll
using (FileStream fs = new FileStream("\\SD\\test.xml", FileMode.Open, FileAccess.Read, FileShare.None, 512)) { using (StreamReader sr = new StreamReader(fs)) { Stream s = sr.BaseStream; XmlReader r = XmlReader.Create(s); while (r.Read() && !r.EOF) {
#8
Posted 24 December 2010 - 07:51 AM
#9
Posted 24 December 2010 - 09:49 AM
int i = myXml.IndexOf("<tag>"); int j = myXml.IndexOf("</tag>", i); if (i < 0) etc.... string myData = myXml.Substring(i, j-i+1);
Think about it first before ripping into my coding style! You may be able to get away with less code (if including the XmlReader library you have to deploy) and possibly even get better performance. It's very retro-looking code and not suitable for anything complex, but when working with small devices it may be the best way.
#10
Posted 24 December 2010 - 04:44 PM
#11
Posted 24 December 2010 - 05:50 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users