Result = SaveXML(#XML, Filename$ [, Flags])
Saves the #XML tree to the given file.


#XML The XML to save.
Filename$ The filename where the XML should be saved.
Flags (optional) It can be a combination of the following values (with the '|' operator):
  #PB_XML_StringFormat : Includes a byte order mark. See WriteStringFormat() for more information.
  #PB_XML_NoDeclaration: Does not include the XML declaration.
Note: According to the XML specification, the XML declaration can only be omitted if the document is encoded in UTF-8 or UTF-16 or if the encoding information is provided externally through a transfer protocol for example. Even then, it is advised to keep the declaration in the document.

Return value

Nonzero if the file was successfully saved, zero otherwise.


The created XML markup is not reformatted. It is written back as it was initially parsed/created. The amount of newline/whitespace written between the tags is stored in the 'text' of each XML node. (see GetXMLNodeText() for more information) To reformat the XML markup before saving, the 'text' for each XML node can be altered or FormatXML() can be used to apply some common reformatting options to the tree.

See Also

LoadXML(), CreateXML(), FormatXML(), ExportXML(), ComposeXML()

Supported OS


<- RootXMLNode() - XML Index - SetXMLAttribute() ->