Options let you influence the beautifiying process. They are passed to the renderer and thus, you have to check, whether the renderer you are using supports the options you want to use.
As there currently is only one renderer (Plain) available, you should not worry about this too much.
Options can be passed as an associative array to the constructor of XML_Beautifier. You may also use setOption(), or setOptions() to set one or more options after the instance of XML_Beautifier has been created.
Here is a list of all options supported by XML_Beautifier.
Таблица 63-1. XML_Beautifier options
Option | Possible values | Default | Description |
---|---|---|---|
removeLineBreaks | TRUE or FALSE | TRUE | Sets, whether linebreaks should be stripped from cdata sections |
indent | any string | " " (4 spaces) | The string passed to this option will be used to indent the tags in one level. |
linebreak | any string | "\n" | The string passed to this option will be used for linebreaks You should use "\n" or "\r\n". |
caseFolding | TRUE or FALSE | FALSE | Disable or enable case folding for tags and attributes |
caseFoldingTo | "uppercase" or "lowercase" | "uppercase" | Can be used, if caseFolding is set to TRUE to define whether tags and attributes should be converted to upper- or lowercase |
normalizeComments | FALSE or TRUE | FALSE | If set to true, all adjacent whitespaces in an XML comment will be converted to one space. This will convert comments with more than one line to a comment with one line. |
maxCommentLine | integer | -1 | Maximum length of comment line. If a comment exceeds this limit, it will be wrapped automatically. If set to -1 the line length is unlimited. |
multilineTags | TRUE or FALSE | FALSE | If set to true, a linebreak will be added inside the tags after each attribute and attributes will be indeted. |
The following example shows how to set options for XML_Beautifier.
Пример 63-1. Using setOptions() and setOption()
|
The following example shows how to set options for XML_Beautifier, if the instance already has been created.
Пример 63-2. XML_Beautifier options
|
Пред. | Начало | След. |
Example | Уровень выше | XML_Beautifier::XML_Beautifier() |
HIVE: All information for read only. Please respect copyright! |