XMLUtil { public static String toXMLName(final String name) { final StringBuilder builder = new StringBuilder(); boolean firstWord = true; for (int i = 0; i < name.length(); i++) { final char c = name.charAt(i); if (i == 0) { builder.append(Character.toLowerCase(c)); } else { if (firstWord) { if (i + 2 < name.length() && Character.isLowerCase(name.charAt(i + 2))) { firstWord = false; } builder.append(Character.toLowerCase(c)); } else { builder.append(c); } } } return builder.toString(); } private  XMLUtil(); static String toXMLName(final String name); static String prettyPrintXML(final String xml); static void prettyPrintXML(final InputStream inputStream, final OutputStream outputStream); static void prettyPrintXML(final Reader reader, final Writer writer); static TransformerHandler createTransformerHandler(final boolean indentOutput); static TransformerHandler createTransformerHandler(final ErrorListener errorListener,
                                                              final boolean indentOutput); static void setCommonOutputProperties(final Transformer transformer, final boolean indentOutput); static final SAXParserFactory PARSER_FACTORY; }
@Test void testWords() { assertThat(XMLUtil.toXMLName(XMLUtil.class.getSimpleName())).isEqualTo("xmlUtil"); assertThat(XMLUtil.toXMLName(String.class.getSimpleName())).isEqualTo("string"); assertThat(XMLUtil.toXMLName(StringBuilder.class.getSimpleName())).isEqualTo("stringBuilder"); assertThat(XMLUtil.toXMLName(TestXMLUtil.class.getSimpleName())).isEqualTo("testXMLUtil"); }