As per the code given by you, variable x
is supposed to contain valid XML which is not there. Once you put a valid XML there, hopefully your code will work.
Valid XML is something like as given at
string x = "<TestDataXml><DataName>testing</DataName></TestDataXml>" ;
So correct that line and for more n valid XML please have a look at:
A resolution for similar issue also given here: