I have an XElement and I need to add more elements to it from a string. The string contains multiple xml elements in it that I need to parse. I have tried both XDocument.Load and XElement.Parse but get errors. The contents of the file are as follows:
<menu id="a">
<menuItem keyID="0">
<command>test</command>
</menuItem>
<menuItem keyID="0">
<command>test</command>
</menuItem>
</menu>
<menu id="b">
<menuItem keyID="0">
<command>test</command>
</menuItem>
<menuItem keyID="0">
<command>test</command>
</menuItem>
</menu>
<ecs>
<areas>
<area longitudeFrom="20.35" longitudeTo="20.37" />
<area longitudeFrom="20.44" longitudeTo="20.46" />
<area longitudeFrom="20.22" longitudeTo="20.25" />
</areas>
</ecs>
What is the best way to read all the elements from this string and add them to an existing XElement ?