Main Site Documentation

Whats the best way to manipulate XML in NETMF?


#1

Hi All,

What is the best way to manipulate XML on using Net MF 4.1? I just want to change the value of an attribute / the text content of the node.

Any ideas? I can’t seem to find too much on this (Reading XML is fine with XmlReader).

Cheers,

Ross


#2

The issue really is how you intend to navigate around the XML.

If you were anticipating using conventional .NET Xpath or XSLT functionality, from my (limited) research, I think that NETMF 4.1 has no native support, but of course, it’s quite possible someone’s built some extensions (particularly xpath-y stuff).

You do have iterators so you can execute a forward walk thru’ nodes via looping code, and it looks like you have the ability to insert and manipulate nodes programatically with System.Xml just as you could in a fuller framework.

As you’ve identified though there really isn’t much in the way of manipulating XML Documents as such except via System.Ext.Xml and doing a back-to-back read-write, and intercepting the process when the attribute you’re interested in is observed. The whole thing starts looking like writing output to a tape drive :slight_smile:

Depending on just how nutty you wanted to go on this, I guess you could pick the XML up in a conventional MemoryStream or a StreamReader with appropriate encoding, and build a tree traverser that walked thru’ tags and manipulated the XML via standard string handling (ugh).


#3

I will upload my code soon. :wink: