I'm using DOMParser to parse some raw xml data loaded into a string. Given a particular Node object, I need to obtain the raw xml data for that node and everything beneath it in the tree.
For example, given:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<elem>
<div>this is some text</div>
</elem>
</root>
...and given a node object representing the <elem> element, I need to obtain:
"<elem>
<div>this is some text</div>
</elem>"
...as a string.