xmlReadStr
Read a XML tree from a string
Syntax
xdoc = xmlReadStr(string [, validateDTD])
Arguments
- string
a string, containing XML code.
- validateDTD
a boolean to indicate if the document must be validated.
- xdoc
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
xdoc = xmlReadStr("<root><a att=""foo"" rib=""bar""><b>Hello</b></a></root>"); e = xdoc.root.children(1).children(1) e.name e.content xmlDump(e) xdoc.root.children(1).attributes.att xdoc.root.children(1).attributes.rib // Modify the attributes xdoc.root.children(1).attributes.att = "truc" xdoc.root.children(1).attributes.rib = "machin" xmlDump(xdoc.root.children(1)) // We delete the doc xmlDelete(xdoc);
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
| Version | Description |
| 5.4.0 | XML module introduced. |
| Report an issue | ||
| << xmlRead | XML Management | xmlRelaxNG >> |