There are two styles for using XmlOptions: multiline setup, and single-line use. Here are two examples. First, multiline style:
XmlOptions opts = new XmlOptions(); opts.setSavePrettyPrint(); opts.setSavePrettyPrintIndent(4); System.out.println(xobj.xmlText(opts));The alternative is single-line usage:
System.out.println(xobj.xmlText( new XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(4)));Table showing where each option gets used. Note that:
newInstance
methods will also apply for parse
methodsvalidate
methods are also used for compile
methods, since compilation usually implies validation against Schema for SchemasnewInstance methods | parse methods | validate methods | compile methods | save and xmlText methods |
---|---|---|---|---|
setDocumentType setDocumentSourceName setValidateOnSet setUnsynchronized | setLoad*** setEntityResolver | setErrorListener setValidateTreatLaxAsSkip | setErrorListener setCompile*** setEntityResolver setGenerateJavaVersion | setSave*** setUseDefaultNamespace setCharacterEncoding |
@author FracPete (fracpete at waikato dot ac dot nz) @version $Revision: 1.4 $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|