FAQ Database Discussion Community


When is NodeList live and when is it static?

javascript,html,nodelist
From MDN for querySelectorAll(): In some cases, the NodeList is a live collection, which means that changes in the DOM are reflected in the collection. For example, Node.childNodes is live: var parent = document.getElementById('parent'); var child_nodes = parent.childNodes; console.log(child_nodes.length); // let's assume "2" parent.appendChild(document.createElement('div')); console.log(child_nodes.length); // should output "3" In...

Get Attribute value of specfic tag

java,xml,xml-parsing,saxparser,nodelist
I'm trying to extract the values of attributes "address" , "programmaticName" of the tags "datapoint" , "event" & "command". The problem i'm facing is that i want to extract the values belonging to a particular protocol "BACNET" and not all the protocols in the XML file. XML FILE.. <elementDefinitionModel manufacturerInSymbol="LIEBERT"...

How to get the node with min attribute value?

xml,xpath,min,nodelist
My xml structure is something like this : <page height="777" width="777"> <block r="777" l="778" blockType="Text"> <region/> <separator/> </block> <block r="777" l="790" blockType="Text"> <region/> <separator/> </block> <block r="777" l="688" blockType="Text"> <region/> <text/> </block> </page> i want the select the block node which has the min "l" value i.e "688" I know...

usin NodeList with similar values

android,xml,nodelist
I have below xml file to store my events: <event day="23" month="4" year="2015" mod="mod1" > event 1 </event> <event day="23" month="4" year="2015" mod="mod1" > event 2 </event> <event day="24" month="6" year="2015" mod="mod2" > event 3 </event> <event day="24" month="7" year="2015" mod="mod3" > event 4 </event> and useing this methed to...

Recurse over childNodes

javascript,nodelist,child-nodes
Take a look at the code below, with the console open. There are a handful of nodes logged to the console. function recurseChildren(element) { var children = element.childNodes, length = children.length; if (length) { for (var i = 0; i < length; i++) { console.dir(children[i]); recurseChildren(children[i]); } } } recurseChildren(document.body);...

Removing even numbers from a linked list not working at the tail node?

java,data-structures,linked-list,nodelist
void deleteEven() { boolean con = false; Node add; Node move; move = head; if (move.data % 2 == 0) { head = move.next; con = true; } add = move; move = move.next; while (move != null) { if (move.data % 2 == 0 ) { add.next = move.next;...

What does this line do? (xml2json conversion in javascript)

javascript,json,xml,dom,nodelist
Hi I have found a method on-line for converting XML to JSON. I have been using it for a bit and it works well. Now I need to modify it to meet my specific needs but modifying it is difficult because I do not completely understand what this method is...