var arr = new Array();; var allPaths = someElement.selectAll('path');
allPaths.forEach(function(item,index) { arr.push(item.toString()); return true; }, allPaths); console.log(arr.join('\n'));
Output (something like below):
<circle cx="50" cy="50" r="50" fill="#64e600" style=""/>
<circle cx="50" cy="50" r="50" fill="#ff0000" mask="url('#Shpvrov896')" style=""/>
<circle cx="251.5" cy="125" r="45" fill="#f5e2c6" style=""/>
<circle cx="224" cy="112" r="6" fill="#000000" style=""/>
<circle cx="295" cy="5" r="5" fill="#ffffff" style=""/>
<circle cx="251.5" cy="247" r="10" fill="#f5e2c6" style=""/>
var txtpth = s.path("M70 70 Q 80 90 200 150 L 200 400").attr({ fill: "none", stroke: "black" }); console.log(txtpth.toString());
Output:
<path d="M70 70 Q 80 90 200 150 L 200 400" fill="none" stroke="#000000" style=""/>