question: protected static Map < String , String > parseSetAttributesAsTextArg ( String text ) { String value = "" ; String key = "" ; StringBuilder buffer = new StringBuilder ( ) ; Map < String , String > keyValuePairs = new HashMap < > ( ) ; boolean isInsideQuotes = false ; for ( int i = 0 , N = text . length ( ) ; i < N ; ++ i ) { final char c = text . charAt ( i ) ; if ( c == '=' ) { key = buffer . toString ( ) ; buffer . setLength ( 0 ) ; } else if ( c == '\"' ) { if ( isInsideQuotes ) { value = buffer . toString ( ) ; buffer . setLength ( 0 ) ; } isInsideQuotes = ! isInsideQuotes ; } else if ( c == ' ' && ! isInsideQuotes ) { keyValuePairs . put ( key , value ) ; } else { buffer . append ( c ) ; } } if ( ! key . isEmpty ( ) && ! value . isEmpty ( ) ) { keyValuePairs . put ( key , value ) ; } return keyValuePairs ; }
target:  Parses the text argument text from DOM.setAttributeAsText() Text will be in the format "attribute1=\"Value 1\" attribute2=\"Value2\""