Main Site Documentation

Xmlreader in TinyCLR


Is there an Xmlreader than can be accessed in tinyclr?


Not as part of the built in libraries. You may be able to find a managed implementation that you can port though, perhaps on NuGet or our old CodeShare.


So I should be looking for code that runs on tinyclr, netmf or .net standard? The codescape is vast; any navigation help would be appreciated.


We have been evaluating adding XML vs adding json. Any input on preferences and why?


Ok let’s do this:

  • XML is intended as a document format, for storing data and it’s associated metadata. Json is intended as a means of exchanging information, particularly over the web. If it’s a configuration file, it should be xml. If it’s a web service it should be json.

  • Json is far easier to implement in code than then entire working XML specification. This is because of the simplicity of the format.

  • Xml supports comments and is self documenting. Json has no means of storing comment sections.

  • Xml tends to be easier to read and follow since it uses named closing tags. Json uses parenthesizes and square brackets, which is not easy to follow when reading. (i.e. xml is more readable)

  • Json parsing is fast and efficient. Xml parsing is slower and more memory intensive. Json is better when your system is memory constrained.

  • Json is supported on just about every language and platform. Xml, being harder to implement tends to be missing on certain platforms. (wink wink)

  • Xml is mature and well understood (and is easy to teach). Json is mostly only understood by programmers.

  • Json is syantax light and consumes less storage to hold the same data as an Xml Document.

Being a c# guy I much perffered using Xml over Json, and I resisted Json adoption. But Json was so easy to implement that it didn’t take much to get me on board. I now use Xml solely for configuration type files and datasets with limited rows. I use Json for larger data sets and for sending data between systems. If I have large amounts of relational data, then I use SqlLite.


I agree and the is why we are debating this my gut feeling says json but then XML is great for some needs.


Why not do both :slight_smile:, then all you need to decide is which one to implement first :smiley:


Would it help if “someone” ported NewtonSoft Json to TinyClr? That way you guys could work on Xml.


I looked into porting the System.Xml from the open source .net core framework. It uses generics and other modern c# stuff. It’s quite a bit of code so it looks tedious. I also looked into porting Newtonsoft.Json; so far nothing “modern” looking in it. It even has it’s own math functions for doing computations. Looks to be a bit easier.


NETMF had XML implemented in managed code originally and then it changed to native code to give it speed boost. The code is still out there somewhere.


Xml would be my choice if had to choose.
Id prefer editing an xml config file and json. And largely use xml for 3-4 page long ‘system configuration documents’/storage.
Json is light weight, useful for web comms, but I hate it to express human readable info