Hello venuela,
how about the following, to change the space characters to underscores?
String text= element.getText();
String elementName = text.replace(' ', '_');
rootElement.setName(elementName);
You could also use the replaceAll(String regex, String replacement) method in the String class to do something more complex, if required.
Greetings,
Trevor.
#webMethods-Tamino-XML-Server-APIs#webMethods#API-Management