1

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.

1 Answer 1

3

W3C provides DOM Level 3 Load/Save spec but I am not aware of any native implementation in browsers. However, you can use de factor standard component XMLSerializer to get the xml content out.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.