SettingUtils { public static String qnameValues2String(Map<QName, String[]> valueMap) { StringListConfig config = StringListConfig.Factory.newInstance(); for (Map.Entry<QName, String[]> entry : valueMap.entrySet()) { String nameAndValues = qname2string(entry.getKey()) + "=" + StringUtils.join(entry.getValue(), ","); config.addEntry(nameAndValues); } return config.toString(); }  static Collection<? extends QName> string2QNames(String string); static String qnames2String(Collection<? extends QName> qnames); static String qnameValues2String(Map<QName, String[]> valueMap); static Map<QName, String[]> string2QNameValues(String string);  }
@Test public void testQnameValues2String() throws Exception { LinkedHashMap<QName, String[]> valueMap = new LinkedHashMap<QName, String[]>(); valueMap.put(new QName("x"), new String[]{"1", "2", "3"}); valueMap.put(new QName("ns2", "y"), new String[]{"a", "b", "c"}); ArrayList<String> expected = new ArrayList<String>(); expected.add("x=1,2,3"); expected.add("y@ns2=a,b,c"); String result = SettingUtils.qnameValues2String(valueMap); StringListConfig config = StringListConfig.Factory.parse(result); assertEquals(expected, config.getEntryList()); assertEquals(valueMap2String(valueMap), valueMap2String(SettingUtils.string2QNameValues(result))); }