Found the answer:
Thank you. What’s the difference between getText() and toString(SaveFormat.TEXT)?
Document doc = new Document();
// Enter a dummy field into the document.
DocumentBuilder builder = new DocumentBuilder(doc);
// GetText will retrieve all field codes and special characters
System.out.println("GetText() Result: " + doc.getText());
// ToString will export the node to the specified format. When converted to text it will not retrieve fields code
// or special characters, but will still contain some natural formatting characters such as paragraph markers etc.
// This is the same as “viewing” the document as if it was opened in a text editor.
System.out.println("ToString() Result: " + doc.toString(SaveFormat.TEXT));
Great, thank you for the clarification!