Scilab 6.1.0
- Ajuda do Scilab
- XML Management
- htmlDump
- htmlRead
- htmlReadStr
- htmlWrite
- xmlAddNs
- xmlAppend
- xmlAsNumber
- xmlAsText
- xmlDelete
- xmlDocument
- xmlDTD
- xmlDump
- xmlElement
- xmlFormat
- xmlGetNsByHref
- xmlGetNsByPrefix
- xmlGetOpenDocs
- xmlGetValues
- xmlIsValidObject
- xmlName
- xmlNs
- XML Objects
- xmlRead
- xmlReadStr
- xmlRelaxNG
- xmlRemove
- xmlSchema
- xmlSetAttributes
- xmlSetValues
- xmlValidate
- xmlWrite
- xmlXPath
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
xmlRead
Read a XML stream from a local or distant file
Syntax
doc = xmlRead(path [, encoding] [, validateDTD])
Arguments
- path
a string, the path to the file to read.
- encoding
a string, the file encoding.
- validateDTD
a boolean to indicate if the document must be validated.
- doc
a mlist typed XMLDoc
Description
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.
Examples
doc = xmlRead("http://www.w3.org/TR/2009/REC-xml-names-20091208/xml-names-10-3e.xml"); e = doc.root.children(1).children(1) e.name e.content xmlDump(e) // Now we can retrieve all the nodes with an 'href' attribute q = xmlXPath(doc, "//*[@href]"); q(1).attributes.href // We delete the doc xmlDelete(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.
History
Version | Description |
5.4.0 | XML module introduced. |
5.5.0 | Add new argument to select file encoding. |
Report an issue | ||
<< XML Objects | XML Management | xmlReadStr >> |