FormatXML(#XML, Flags [, IndentStep])
Cleans up or reformats the XML tree for a better look when exporting/saving. It can be used to have a very compact output for efficient transfer or a more formatted output for better reading.

The formatting of the parsed XML document is stored in the 'text' and 'offset' fields of each node in the tree (see GetXMLNodeText() and GetXMLNodeOffset() for more information).


#XML The XML to format.
Flags It can be a combination of the following values (with the '|' operator):
  #PB_XML_WindowsNewline: Changes all newline to CRLF
  #PB_XML_LinuxNewline  : Changes all newline to LF
  #PB_XML_MacNewline    : Changes all newline to CR

  #PB_XML_CutNewline    : Removes all newline
  #PB_XML_ReduceNewline : Removes all empty lines

  #PB_XML_CutSpace      : Removes all spaces
  #PB_XML_ReduceSpace   : Removes all multiple spaces
  #PB_XML_ReFormat      : Completely reformats the tree structure
  #PB_XML_ReIndent      : Changes the indentation of the lines
For #PB_XML_ReFormat and #PB_XML_ReIndent the 'IndentStep' parameter specifies how many spaces of indentation to add for each level.

Note: There is no reformatting in CData sections and Processing Instructions except for the newline changes, as the whitespace contained inside these sections may be important depending on what is contained in the section.

Note: Since MacOSX, the CR newline has become less common and the LF newline is used mostly like on other Unix systems. The #PB_XML_MacNewline is provided for completeness, but it is usually better to use #PB_XML_LinuxNewline even on MacOSX.
IndentStep (optional) The indent to apply (in characters) when using the #PB_XML_ReFormat or #PB_XML_ReIndent flags

Return value


See Also

ExportXML(), SaveXML()

Supported OS


<- ExtractXMLStructure() - XML Index - FreeXML() ->