Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.0 - Français

Change language to:
English - 日本語 - Português - Русский

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

Aide de Scilab >> Gestion des fichiers XML > xmlRead


Read a XML stream from a local or distant file

Calling Sequence

doc = xmlRead(path [, encoding] [, validateDTD])



a string, the path to the file to read.


a string, the file encoding.


a boolean to indicate if the document must be validated.


a mlist typed XMLDoc


Read and parse a XML file. The returned document allows to access to the DOM tree which is kept in memory.

If validateDTD is set to true, the document will be validated or not during the parsing operation.

The encoding argument is used to precise the file encoding.

It is important to notice that the tree must be freed (to avoid memory leaks) with the function xmlDelete.


doc = xmlRead("");
e = doc.root.children(1).children(1)

// Now we can retrieve all the nodes with an 'href' attribute
q = xmlXPath(doc, "//*[@href]");

// We delete the doc

See Also

  • xmlReadStr — Read a XML tree from a string
  • xmlGetOpenDocs — Get all open XML documents or all open XML Validation files.
  • xmlDelete — Delete a XML document
  • xmlDocument — Create a new XML document
  • xmlXPath — Make a XPath query on a XML document
  • xmlValidate — Validate a document in using a DTD, a Relax NG or a Schema.


5.4.0 XML module introduced.
5.5.0 Add new argument to select file encoding.
Report an issue
<< xmlNs Gestion des fichiers XML xmlReadStr >>

Copyright (c) 2022-2023 (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:
Fri Apr 11 14:14:55 CEST 2014