HTML 5 - DOMParser and XMLSerializer

E-mail Print PDF

DOMParser and XMLSerializer

Easily switch from XML to DOM and back again.

This demo uses DOMParser and XMLSerializer to sync XML source with a live rendering in the DOM. These cross-browser APIs work with XML and the DOM much in the same way JSON works with JavaScript objects. DOMParser converts an XML string into a renderable DOM. Likewise, XMLSerializer converts any DOM node into an XML string, even HTML elements.

Edit the XML in the text area and click the left arrow button to use DOMParser to update the live rendering. Click on elements in the live rendering to delete them, then click the right arrow button to use XMLSerializer to update the XML source. You can also use the links below to switch between some pre-configured SVG and XHTML examples.

Pre-built Examples: SVG, XHTML

 

read more ...