Previous topic

XML_ParserFree

Next topic

XML_SetCharacterDataHandler

This Page

xml_save_nodeΒΆ

xml_save_node save a specially formatted UniScript object as an XML file.

bool = xml_save_node(oXML, ssFileName)
bool = xml_save_node(oXML, ssFileName, nFormatted)

Return Value

bool is TRUE (1), if the function was successful and otherwise FALSE (0).

Parameters

oXML

oXML is a special formatted UniScript object (see Comment).

ssFileName

ssFileName is the file name, e.g. c\\test\\text.xml

nFormatted
Value Description
0 Write new line characters. New lines are only added to text elements. (Default)
1 New line characters and indentation with two spaces.

Comment

The object oXML must have the following structure:

oXML = [.
   [1] = "text node"
   [2] = oXML
   [N] = ...
   attr = [. name=ssValue, ...]
   name = "element name"
]

Example

// File created from "script\uniscript\xml_save_node.ic".

def test_xml_save_node()
{
    o = xml_parse_string("<a att='1'>mixed<b>contents</b><c><d></d></c></a>")
    print o
    o[2].name = "i";
    print o
    ssFile = GetTempFileName();
    xml_save_node(o, ssFile, 1);
    print text_file_read(ssFile);
    DeleteFile(ssFile);
}
test_xml_save_node()

History

Version Description
5.20 New.

id-1241474