JSFiddle - React, Tailwind, and code Playground

JavaScript

var xml='<root><book>  The Lord of the Rings  <author>JRR Tolkien</author></book></root>';

$(xml).find('book').each(function(){
    var text=$(this).contents().eq(0).text();
    $('body').append( text);
});