from XMLNode by Jarrod Rivituso
MATLAB class that allows you to use XPath to navigate and extract data from an XML document.

xmlNodeNamespaceExample.m
%Example use of XMLNode class
XMLNode.initialize;

%Create node using document name
v = XMLNode('outline.xml')

%Basic navigation with namespaces
v('pre1:course')
v('pre1:course/pre1:path_list')
allPaths = v{'pre1:course/pre1:path_list/pre1:dir_name'}

%Use of axes with namespaces
v('//pre1:time')
allTimes = v{'//pre1:time'}

%Adding and then using a custom prefix
addNamespacePrefix(v,'newPrefix','http://www.mathworks.com/training/course_development')
v('newPrefix:course')

Contact us