the code:
var readerSettings = new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment };
using (var reader = XmlReader.Create(inputz, readerSettings))
{
while (reader.Read())
{
using (var fragmentReader = reader.ReadSubtree())
{
if (fragmentReader.Read())
{
var fragment = XNode.ReadFrom(fragmentReader) as XElement;
what its outputting:
<sys>
<id>FSB</id>
<label>FSB</label>
<value>266</value>
</sys>
<sys>
<id>CPU</id>
<label>speed</label>
<value>2930</value>
</sys>
how would i change it so that it writes “value” to a string instead? so the output looks like : ,266,2930
thanks
Well the obvious answer is to convert to a string –
or, if necessary,
I’m not 100% sure this will achieve what you’re trying to do, but it will return your XML snippet as a string.
edit
Now that the question has been updated, I can give some more information. I’ll assume that each
fragmentis in fact thesysnode.You first need to get the
valuenode, and then retrieve its ‘value’ (ie its content).