Extracting attributes of elements XML with different numbers of children

I have this XML file: <?xml version="1.0" encoding="UTF8"?> <locations> <loc loc_id="11703"> <height type="low">22.19</height> <height type="high">24.19</height> </loc> <loc loc_id="11702"> <height type="low">22.95</height> </loc> <loc loc_id="11702"> <height type="mid">24.4</height> </loc> <loc loc_id="11702"> <height type="high">24.95</height> </loc> <loc loc_id="11701"> <height type="low">17.65</height> <height type="mid">23.99</height> </loc> <loc loc_id="11700"> <height type="low">21.49</height> <height type="high">23.45</height> <height type="mid">23.3</height> </loc> <loc loc_id="11699"> <height type="low">21.65</height> <height type="high">24.14</height> </loc> </locations>… Read More Extracting attributes of elements XML with different numbers of children

JavaScript ARIA Role equivalent of nodeName

If I want to get the nodeName for all HTML ins elements I can use nodes = document.querySelectorAll("ins"); for (let n = 0; n < nodes.length; n++) { nodes[n].setAttribute("data-name-prohibited", nodes[n].nodeName); } This returns data-name-prohibited="ins” I want to get the ARIA Role type nodes = document.querySelectorAll("[role=insertion]"); for (let n = 0; n < nodes.length; n++) {… Read More JavaScript ARIA Role equivalent of nodeName

Transform list in a JSON, then adding an header on top of this JSON

I have a list of objects: List<ScuolaEntity> result = scuolaService.getAllScuoleEntity(); I would like to convert the list in a json object, I have tried with gson, with JSONObject and even with JsonNode, but I couldn’t find a way to add a header/node to the json. This is the actual json: [ { "codiceMeccanografico": "RMAT123456", "codiceFiscale":… Read More Transform list in a JSON, then adding an header on top of this JSON