vb.net deserialize an xml string -
i've got simple xml string looks this:
<?xml version="1.0"?> <accountbalance> <value> 22.00 </value> </accountbalance>
i'd set value of <value>
variable in vb.net. how do this?
not sure serialization comes play this, if it's simple xml string can use linq xml value quite easily:
dim xml xelement = new xelement.parse(xmlstring) dim balance integer = x in xml.descendants("value") select cint(x.value)
this give collection of value elements in xml. if have one, can this:
dim balance integer = (from x in xml.descendants(xmlstring) select cint(x.value)).singleordefault()
xmlstring xml string want values - parse
method loads xml supplied string. use .load
if it's in file.
syntax might bit off - i'm doing off top of head.
Comments
Post a Comment