3

I am creating a xml file, but am unable to convert the string in the tag <Nb>

 <Header>
 <Body>
 <Nb>13</Nb>    
 </Body>
 </Header>

How do I convert it to an XElement item? I want to avoid using Linq, XmlDoc if possible...

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Chubaku
  • 33
  • 4

1 Answers1

1

Try using the XElement.Parse like so

private XElement XmlNumber()
{    
   XElement nb = XElement.Parse("<Header><Body><Nb>13</Nb></Body></Header>");

   return nb;    
}

Examples here: How to convert from string to XElement object

Paul
  • 5,473
  • 1
  • 30
  • 37
Irelia
  • 76
  • 1
  • 7