Class XmlOptions

java.lang.Object
org.apache.xmlbeans.XmlOptions
All Implemented Interfaces:
Serializable

public class XmlOptions
extends Object
implements Serializable
Used to supply options for loading, saving, and compiling, and validating.

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:

  • options available for newInstance methods will also apply for parse methods
  • options used for validate methods are also used for compile methods, since compilation usually implies validation against Schema for Schemas
newInstance methods parse methods validate methods compile methods save and xmlTextmethods
setDocumentType
setDocumentSourceName
setValidateOnSet
setUnsynchronized
setLoad***
setEntityResolver
setErrorListener
setValidateTreatLaxAsSkip setValidateStrict
setErrorListener
setCompile***
setEntityResolver
setBaseURI
setGenerateJavaVersion
setSave***
setUseDefaultNamespace
setCharacterEncoding
See Also:
Serialized Form