I want to remove the first and last two lines from the following XML. I am using the following method to omit just the first top and last line, how can I amend it to remove the top two and last two lines? So, to remove node1 and node2.
<node1>
<node2>
<context>
<FirstName>barb</FirstName>
<LastName>tor</LastName>
</context>
</node2>
</node1>
var xml ='<node1><node2><context><FirstName>David</FirstName><LastName>Test</LastName></context></node2></node1>';
const innerStart = xml.indexOf(">") + 1;
const innerEnd = xml.lastIndexOf("<");
const inner = xml.slice(innerStart, innerEnd);
console.log(inner)