Skip to content

Instantly share code, notes, and snippets.

@rmpestano
Last active July 13, 2017 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmpestano/d873c24854efeb91c0b0379c038ebd3e to your computer and use it in GitHub Desktop.
Save rmpestano/d873c24854efeb91c0b0379c038ebd3e to your computer and use it in GitHub Desktop.
Format facelets sample

tested against this facelets file.

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

Document.OutputSettings outputSettings = new Document.OutputSettings();
outputSettings.prettyPrint(true)
		.charset("UTF-8")
		.indentAmount(4)
		.syntax(Document.OutputSettings.Syntax.xml);

Parser parser = Parser.xmlParser().settings(new ParseSettings(true, true));
String formatedContent = parser.parseInput(originalContent, "UTF-8")
						.outputSettings(outputSettings).toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment