code: private String  textXMLSpaceTransform(String text, boolean isFirstChild, boolean isLastChild)
     {
        if (state.spacePreserve)  // xml:space = "preserve"
           return text.replaceAll("[\\n\\t]", " ");
  
        // xml:space = "default"
        text = text.replaceAll("\\n", "");
        text = text.replaceAll("\\t", " ");
        //text = text.trim();
        if (isFirstChild)
           text = text.replaceAll("^\\s+",  "");
        if (isLastChild)
           text = text.replaceAll("\\s+$",  "");
        return text.replaceAll("\\s{2,}", " ");
     }
docs: Process the text string according to the xml:space rules