nodes

PL/SQL: Count number of nodes in xml

微笑、不失礼 提交于 2019-12-06 09:14:24
问题 I am working with Oracle. Is there a way to count the number of nodes (including descendants) within an XML file using PL/SQL? I would like to be able to save the result as a variable to be used as an upper limit for a loop iterator. I have the following xml, and I want to count the number of nodes within the row node: <row> <date name="date1" id="101"></date> <element1 name="ele1" id="111"> <stuff></stuff> <stuff></stuff> <stuff></stuff> </element1> <element2 name="ele2" id="121"></element2>

Using the force-layout physics for seperated elements

对着背影说爱祢 提交于 2019-12-06 08:47:30
I use the force layout in D3.js v4. Now I want to click on a node and use the force physics like collide for that one node only. The simulation for every node on the entire SVG is this: var simulation = d3.forceSimulation() .force("link", d3.forceLink().id(function(d) { return d.index })) .force("collide", d3.forceCollide(function(d) { return d.r + 8 }).iterations(16)) .force("charge", d3.forceManyBody()) .force("center", d3.forceCenter(chartWidth / 2, chartWidth / 2)) Now I want to change the collide behavior for the one node I clicked on to push other nodes away or attract them. Is there

How to get Node class instance from MObject in Maya API

限于喜欢 提交于 2019-12-06 08:10:24
In a cpp plugin I am developing in Maya API, I register a custom MPxTransform Node in the initializePlugin function: status=pluginFn.registerTransform("mympxtransform", myMPxTransformClass::id, &myMPxTransformClass::creator, &myMPxTransformClass::initialize, &myMPxTransformMatrixClass::creator, myMPxTransformMatrixClass::id); And then create the node programmatically: MDagModifier mdagmod; MObject MyMObject; MyMObject=mdagmod.createNode("mympxtransform",MObject::kNullObj,&status); I can see the node properly created in the outliner. But now, how can I access my custom myMPxTransformClass from

C# Find And Replace XML Nodes

谁说我不能喝 提交于 2019-12-06 04:25:57
问题 Edit: I decided to take the LINQ to XML approach (see the answer below) that was recommended and everything works EXCEPT that I can't replace out the changed records with the records from the incremental file. I managed to make the program work by just removing the full file node and then adding in the incremental node. Is there a way to just swap them instead? Also, while this solution is very nice, is there any way to shrink down memory usage without losing the LINQ code? This solution may

Python networkx : edge contraction

不问归期 提交于 2019-12-06 02:04:01
问题 I have a NetworkX graph. I would like to know how to do edge contraction between multiple nodes. For example, if I wanted to contract X, Y and Z: _ node A _ _/ | \_ node X --- node Y --- node Z Would become node A | node XYZ (or whatever X/Y/Z) Graph creation is not the problem. It works. I want to reduce the graph by merging nodes that have the same "meanings": nodes that I call "end lvl" (node name length is equal to 7) and that are linked together. I have found the condensation function in

networkx - change node size based on list or dictionary value

倾然丶 夕夏残阳落幕 提交于 2019-12-06 01:56:48
问题 I'm trying to make a graph in networkx. I'm having trouble assigning different node sizes to the nodes. Here is my code I've been playing with: import sys from collections import defaultdict import networkx as nx import matplotlib.pyplot as plt inp = sys.argv[1] cluster = sys.argv[1] + ".cluster" counts = sys.argv[1] + ".counts" with open(cluster, "r") as f1: edges = [line.strip().split('\t') for line in f1] with open(counts, "r") as f2: countsdic = defaultdict(list) for line in f2: k,v =

JavaScript: Copy Node to DocumentFragment

寵の児 提交于 2019-12-05 22:10:10
I gather that the whole point of a DocumentFragment is to be able to construct the contents without touching the DOM until it’s ready to go. Given that DocumentFragment doesn’t support innerHTML , it can be a bit tedious. On the other hand, once constructed, it’s easy to add the contents to an existing DOM node by the fragment itself. If I create a div without adding it to the DOM, I can populate it how I like, including innerHTML . As far as I can tell, it should have no additional impact on performance. Is there a simple way (ie in one line or so) to copy the contents of an existing DOM node

How to Traverse a N-Ary Tree

≡放荡痞女 提交于 2019-12-05 18:04:43
My Tree/Node Class: import java.util.ArrayList; import java.util.List; public class Node<T> { private T data; private List<Node<T>> children; private Node<T> parent; public Node(T data) { this.data = data; this.children = new ArrayList<Node<T>>(); } public Node(Node<T> node) { this.data = (T) node.getData(); children = new ArrayList<Node<T>>(); } public void addChild(Node<T> child) { child.setParent(this); children.add(child); } public T getData() { return this.data; } public void setData(T data) { this.data = data; } public Node<T> getParent() { return this.parent; } public void setParent

Is the root node an internal node?

∥☆過路亽.° 提交于 2019-12-05 17:26:32
问题 So I've looked around the web and a couple of questions here in stackoverflow here are the definition: Generally, an internal node is any node that is not a leaf (a node with no children) Non-leaf/Non-terminal/Internal node – has at least one child or descendant node with degree not equal to 0 As far as i understand it, it is a node which is not a leaf. I was about to conclude that the root is also an internal node but there seems to be some ambiguity on its definition as seen here: What is

different between “getDocumentElement” and “getFirstChild”

一个人想着一个人 提交于 2019-12-05 15:36:23
问题 I have the following Document object - Document myDoc . myDoc holds an XML file by... myDoc = DocumentBuilderFactory.newInstance() .newDocumentBuilder().parse(file); Now I want to get the root of the XML file. Is there any difference between Node firstChild = this.myDoc.getFirstChild() and Node firstChild = (Node)myDoc.getDocumentElement() In the first way, firstChild holds a node root of an XML file but it will not have the depth of Node . However, in the second way, firstChild will be the