20. saveOptions
Prev | Chapter 7. Configuration elements | Next

## 20. saveOptions

    <saveOptions
      encoding = (ISO-8859-1|ISO-8859-13|ISO-8859-15|ISO-8859-2|
                  ISO-8859-3|ISO-8859-4|ISO-8859-5|ISO-8859-7|
                  ISO-8859-9|KOI8-R|MacRoman|US-ASCII|UTF-16|UTF-8|
                  Windows-1250|Windows-1251|Windows-1252|Windows-1253|
                  Windows-1257)
      indent = none | (int >= 0)
      maxLineLength = unbounded | (int > 0)
      addOpenLines = boolean
      cdataSectionElements = list of XPath (subset)
      saveCharsAsEntityRefs = boolean
      charsSavedAsEntityRefs = list of character ranges
      favorInteroperability = boolean
    />

Force XXE to use the specified save options for this type of document, unless Options → Preferences, Save tab, Override settings specified in config. files checkbox has been checked by the user, in which case, it is the save options specified in the dialog box which are used.

encoding

  Specifies the encoding used for XML files saved by XXE.

indent

  If this value is different from `none`, XML files saved by XXE are indented .

  Note that XXE cannot indent XML files not constrained by a grammar.

indentation

  Specifies the number of space characters used to indent a child element relatively to its parent element.

maxLineLength

  Specifies the maximum line length for elements containing text interspersed with child elements.

  This value is only used as a hint: XML files created by XXE may contain lines much longer than the specified length.

addOpenLines

  If value is `true`, an open line is added between the child elements of a parent element (if the content model of the parent only allows child elements).

cdataSectionElements

  List of XPaths specifying elements. These elements are expected to only contain text and to have an `xml:space="preserve"` attribute.

  Text contained in elements matching any of the XPaths specified by this attribute is saved as a CDATA section. Text inside a CDATA section is not escaped which makes it more readable using a text editor. Example:

      <script type="text/javascript"><![CDATA[function min(x, y) {
          return (x < y)? x : y;
      }]]></script>

  If an element matching any of the XPaths specified by this attribute contains anything other than text (even a comment), it is saved normally.

  Note that, in most configuration elements, XXE only supports the XPath subset needed to implement XML-Schemas (but not only relative paths, also absolute paths). Moreover, for efficiency reasons, an XPath whose last step does not test an element name is ignored. For example, "`foo//*`" is ignored.

saveCharsAsEntityRefs

  Specifies whether characters not supported by the encoding are saved as entity references (example: "`&euro;`") or as numeric character references (example: "`&#8364;`").

  Of course, for a character to be saved as an entity reference, the corresponding entity must have been defined in the DTD.

charsSavedAsEntityRefs

  Specifies which characters, even if they are supported by the encoding, are always saved as entity references.

  For example, the Copyright sign is supported by the ISO-8859-1 encoding but you may prefer to see it saved as "`&copy;`". In such case, specify `charsSavedAsEntityRefs="169"`.

  Ignored if `saveCharsAsEntityRefs` is false.

  This attribute contains a list of character ranges. A character range is either a single character or an actual range ``char1`:`char2``.

  A character may be specified using its Unicode character number, in decimal (example: `233` for e acute), in hexadecimal (example: `0xE9`) or in octal (example: `0351`).

  Because names are easier to remember than numbers, a character may also be specified using its entity name as defined in the DocBook 4.2 DTD (example: `eacute`). Note that is possible whatever is the DTD or Schema targeted by the configuration file.

  ### Note

  There is no need to specify the non-breaking space character (`nbsp` = `160` = `0xa0` = `0240`) as it is always implicitly added to this list.

favorInteroperability

  If value is `true`, favor interoperability with HTML and SGML.

  - Empty elements having a non empty content are saved as "`<tag></tag>`".

  - Empty elements having an empty content are saved as "`<tag />`" (with a space after the tag).

Examples:

    <saveOptions addOpenLines="false" />

    <cfg:saveOptions xmlns="" cdataSectionElements="head/script"/>

    <saveOptions saveCharsAsEntityRefs="true"
                 charsSavedAsEntityRefs="copy reg 023400:024000"/>

Note that a `saveOptions` element does not replace the `saveOptions` element previously found in a configuration file. When a configuration file contains several `saveOptions` elements, these `saveOptions` elements are merged.

Example:

    <cfg:saveOptions xmlns="" cdataSectionElements="script pre"
                     addOpenLines="false"/>
            .
            .
            .
    <cfg:saveOptions addOpenLines="true" encoding="ISO-8859-1"/>

is equivalent to:

    <cfg:saveOptions xmlns="" cdataSectionElements="script pre"
                     addOpenLines="true" encoding="ISO-8859-1" />

Prev | Up | Next
19. relaxng | Home | 21. schema