Main Site Documentation

Xmlreader in TinyCLR


#1

Is there an Xmlreader than can be accessed in tinyclr?


#2

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.


#3

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.


#4

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


#5

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.


#6

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


#7

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


#8

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


#9

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.


#10

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.


#11

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