public class XmlFormat extends Object
String xml = ...;
String oneline = XmlFormat.instance(xml, 10000).forceoneline().cutStringLiterals(400).format());
String formatted = XmlFormat.instance(xml, 10000).forceoneline().indent(" ").format());
| Constructor and Description |
|---|
XmlFormat(String xml,
int treshhold)
Create instance of formatter.
|
| Modifier and Type | Method and Description |
|---|---|
XmlFormat |
cutStringLiterals(int length)
Cause cutting of text literal to specified length.
|
XmlFormat |
forceoneline()
Cause escaping of \r and \n chars.
|
String |
format()
Produce formated output.
|
XmlFormat |
indent(String indent)
Cause indended formatting (default is no formatted)
|
static XmlFormat |
instance(String xml,
int treshhold)
Create instance of formatter.
|
public XmlFormat(String xml, int treshhold)
xml - xml to be formatedtreshhold - if size of xml > treshhold no temporal copy of xml will be created. Otherwice it creates xml.toCharArray() copy is created.public static XmlFormat instance(String xml, int treshhold)
xml - xml to be formatedtreshhold - if size of xml > treshhold no temporal copy of xml will be created. Otherwice it creates xml.toCharArray() copy is created.public XmlFormat indent(String indent)
indent - string to indent (like two spaces " ")public XmlFormat forceoneline()
public XmlFormat cutStringLiterals(int length)
length - length to cut literalspublic String format()
Copyright © 2020. All rights reserved.