Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> XML Management > xmlSetValues


Sets some attribute=value in an XML document for a given tag/XPath


xmlSetValues(xpath, attributes_values)
xmlSetValues(xpath, attributes_values, doc)



a string: XPath request pointing to the chosen tag in the XML document.


a 2xN matrix of strings: the (attribute,value) pairs to set.


mlist typed XMLDoc: the XML document in which to write values. By default, it is the main Scilab preferences file (SCIHOME + '/XConfiguration.xml').


When no explicit XML document doc is indicated, xmlSetValues opens the main Scilab preferences file SCIHOME + '/XConfiguration.xml', looks for the tag pointed to by xpath, updates some of its attributes and related values as provided by attributes_values, and closes the file.

xmlSetValues can also be used on-the-fly on an already open XML document doc. In this case, the document is kept open after leaving xmlSetValues. This mode is useful when several tags must be updated in the same document.

Attributes to update must already exist for the given tag. xmlSetValues is not able to create new ones.

All valid XPath requests are possible. For example to write the XPath request to set proxy settings in the main Scilab configuration file:

  • Opens SCIHOME+'/XConfiguration.xml' and gets the nodes names to access to the expected node:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <interface height="600" path="1/" version="0.17" width="800">
        <general title="_(General)">
        <web title="_(Web)">
                <web command-browser="" command-mailer="" default-browser="true" default-mailer="true"/>
                <proxy enabled="false" host="" password="" port="" user=""/>
                <previous-proxy enabled="false" host="" password="" port="" user=""/>

    The path will be "/interface/web/body/proxy" (or to simplify "//web/body/proxy").

  • Modifying incorrectly some preferences can alter the Scilab's behaviour.


// Get the current values
prev = xmlGetValues("//web/body/proxy", ["enabled", "host", "port"]);
xmlSetValues("//web/body/proxy", ["enabled", "host", "port"; "true", "", "1234"]);

// Ok that's work
xmlGetValues("//web/body/proxy", ["enabled", "host", "port"])

// We restore the previous values
xmlSetValues("//web/body/proxy", ["enabled", "host", "port" ; prev]);
xmlGetValues("//web/body/proxy", ["enabled", "host", "port"])

See also


6.1.0 xmlSetValues() introduced, replacing setPreferencesValue().
Report an issue
<< xmlSetAttributes XML Management xmlValidate >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:53:22 CET 2020