title: How to convert SVG Path (SVGOMPathElement) to array of points?
body: <p>What I'm trying to do: convert an SVG path to an array of (x,y) points.</p>
  
  <p>I have this at the moment:</p>
  
  <pre><code>public Point[] strokeToPoints(Node n){
  
      SVGOMPathElement path = (SVGOMPathElement) n;
  
      System.out.println(path.getAttribute("d")); 
  
      System.out.println(path.getTotalLength());
  
      return null;
  
  }
  </code></pre>
  
  <p>Node n is always a path element extracted from an SVG file which looks something like this:</p>
  
  <p><code>&lt;path id="kvg:098df-s1" kvg:type="㇒" d="M52.75,10.5c0.11,0.98-0.19,2.67-0.97,3.93C45,25.34,31.75,41.19,14,51.5"/&gt;</code></p>
  
  <p>The line</p>
  
  <pre><code>System.out.println(path.getAttribute("d"));
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>M52.75,10.5c0.11,0.98-0.19,2.67-0.97,3.93C45,25.34,31.75,41.19,14,51.5
  </code></pre>
  
  <p>which is fine, but the line</p>
  
  <pre><code>System.out.println(path.getTotalLength());
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at org.apache.batik.dom.svg.SVGPathSupport.getTotalLength(SVGPathSupport.java:41)
      at org.apache.batik.dom.svg.SVGOMPathElement.getTotalLength(SVGOMPathElement.java:131)
  </code></pre>
  
  <p>What's causing this error? I need the total length so I can traverse it collecting the points to an array.</p>