Browsers have parsed XML since the XMLHttpRequest era, when responseXML and jQuery 561 's $.ajax returned documents. Today the pattern is fetch() for the bytes and DOMParser for the tree, with no library. Both examples use BookNest's catalog and run in Chrome 154 1 .
Subsections
JavaScript Integration
JavaScript treats an XML document as a DOM tree, and can load, parse, query, transform, and serialize XML using built-in browser APIs or third-party libraries.This section covers:
- Document Loading with AJAX – retrieving an XML document from the server with XMLHttpRequest.
- String Loading with DOMParser – parsing an XML string already present in the page into a DOM document.
- XQuery with XQIB – running XQuery expressions directly in the browser with the XQIB library.
- XSLT in JavaScript – transforming a loaded XML document with an XSLT stylesheet using XSLTProcessor.
- jQuery – using jQuery's traversal and manipulation methods, plus $.parseXML(), on XML documents.