summaryrefslogtreecommitdiff
path: root/modules/xml/help/en_US/xmlWrite.xml
blob: e2f558ac3aa2ad4d6baca77e6299c56174d97758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution.  The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="xmlWrite" xml:lang="en">
    <refnamediv>
        <refname>xmlWrite</refname>
        <refpurpose>Write a XML document in a file</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Calling Sequence</title>
        <synopsis>
            xmlWrite(doc [, filename] [, indent])
            xmlWrite(doc [, indent])
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>doc</term>
                <listitem>
                    <para>doc, a mlist typed XMLDoc</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>filename</term>
                <listitem>
                    <para>filename, a string</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>indent</term>
                <listitem>
                    <para>indent, a boolean</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>Write a XML document in a file with the given filename or with the document url. If indent is true, then the document will be indented, by default indent is true.</para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
    doc = xmlReadStr("<root><a att=""foo"" rib=""bar""><b>Hello</b></a></root>");
    xmlWrite(doc, TMPDIR+"/foo.xml", %f);

    // Now we open the previous file, modify it and save it
    doc1 = xmlRead(TMPDIR+"/foo.xml");
    doc1.root.children(1).name = "newName";
    xmlWrite(doc1);

    // Now we check that the modification has been done
    doc2 = xmlRead(TMPDIR+"/foo.xml");
    doc2.root.children(1).name

    xmlDelete("all");
    ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See Also</title>
        <simplelist type="inline">
            <member>
                <link linkend="xmlDump">xmlDump</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revremark>XML module introduced.</revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>