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

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

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

Aide de Scilab >> Traitement XML > xmlReadStr

xmlReadStr

Read a XML tree from a string

Syntax

doc = xmlReadStr(string [, validateDTD])

Arguments

string

a string, containing XML code.

validateDTD

a boolean to indicate if the document must be validated.

doc

a mlist typed XMLDoc

Description

Read and parse a XML string. 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.

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

Examples

doc = xmlReadStr("<root><a att=""foo"" rib=""bar""><b>Hello</b></a></root>");
e = doc.root.children(1).children(1)
e.name
e.content
xmlDump(e)
doc.root.children(1).attributes.att
doc.root.children(1).attributes.rib

// Modify the attributes
doc.root.children(1).attributes.att = "truc"
doc.root.children(1).attributes.rib = "machin"
xmlDump(doc.root.children(1))

// We delete the doc
xmlDelete(doc);

See also

  • xmlRead — Read a XML stream from a local or distant file
  • xmlGetOpenDocs — Get all open XML documents or all open XML Validation files.
  • xmlDelete — Delete a XML document
  • xmlDocument — Create a new XML document
  • xmlValidate — Validate a document in using a DTD, a Relax NG or a Schema.

History

VersionDescription
5.4.0 XML module introduced.
Report an issue
<< xmlRead Traitement XML xmlRelaxNG >>

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:
Mon Feb 12 19:15:31 CET 2018