MATLAB class that allows you to use XPath to navigate and extract data from an XML document.
1,6K téléchargements
Mise à jour 1 sept. 2016

Afficher la licence

Using XMLNode, you can read an XML document into MATLAB as an XMLNode object. This object allows you to navigate and extract data from the XML document using XPath queries.
For example, in the XML document of colors (colors.xml)
you could obtain the green hex node using
>> n = XMLNode('colors.xml')
>> n.colors.color(2).hex


>> n = XMLNode('colors.xml')
>> n('colors/color[2]/hex')

To extract traditional MATLAB arrays instead of returning XMLNode objects, use {} indexing.

>> n = XMLNode('colors.xml')
>> greenHex = n{'colors/color[2]/hex'}

Supports namespaces and various character encodings.

If you have enhancement suggestions or if you find a bug, please leave a comment :)

Citation pour cette source

Jarrod Rivituso (2024). XMLNode (https://www.mathworks.com/matlabcentral/fileexchange/34711-xmlnode), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2011b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
En savoir plus sur Structured Data and XML Documents dans Help Center et MATLAB Answers

A inspiré : Gating-ML

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version

Updated license

Setting the toolbox flag

Fixed copyright statements

Updates made based on user comments...

- Empty array now returned when XPath expression is not found in document
- Created an "addNamespacePrefix" method
- Updated command window display