public static Pair < String , String > getAndValidateKeyValuePair ( final String keyValueString ) throws InvalidKeyValueException { String tempInput [ ] = StringUtilities . split ( keyValueString , ' ' , 2 ) ; // Remove the whitespace from each value in the split array tempInput = CollectionUtilities . trimStringArray ( tempInput ) ; if ( tempInput . length >= 2 ) { final String value = tempInput [ 1 ] ; return new Pair < String , String > ( tempInput [ 0 ] , replaceEscapeChars ( cleanXMLCharacterReferences ( value ) ) ) ; } else if ( tempInput . length >= 1 && keyValueString . contains ( "=" ) ) { return new Pair < String , String > ( tempInput [ 0 ] , "" ) ; } else { throw new InvalidKeyValueException ( ) ; } }
Validates a KeyValue pair for a content specification and then returns the processed key and value ..