public static List < String > parseSVGPath ( final String xml ) throws NotAvailableException { final List < String > pathList = new ArrayList <> ( ) ; final Matcher matcher = Pattern . compile ( PATH_REGEX_PREFIX ) . matcher ( xml ) ; while ( matcher . find ( ) ) { // add group one of match to collection because the regex only defines one. pathList . add ( matcher . group ( 1 ) ) ; } // fail if no pattern was found. if ( pathList . isEmpty ( ) ) { throw new NotAvailableException ( "Path" ) ; } // clear prefix and suffix return pathList ; }
This method extracts all svg paths out of the given xml string . Its done by returning all value of each \ d entry . All additional style definitions are ignored .