Loads an XML file and converts its content into a Matlab structure or variable.



v = xml_load(filename)

v = xml_load(filename,attswitch)



xml_load reads the file given in parameter filename and uses xml_parse to convert it into a Matlab data structure or variable. If the file cannot be found, an error will be displayed.


Input Arguments

filename   filename of xml file to load (if extension .xml is omitted, xml_load tries to append it if the file cannot be found).


attswitch optional, default='on':

'on' takes into account attributes idx, size, type for creating corresponding Matlab data types;

'off' ignores attributes in XML element headers.


 Output Arguments

v                   Matlab structure or variable.




This example simply loads the sample file from the given location and converts its contents to a Matlab data structure. (The file has previously been created using xml_save).


v = xml_load('c:/data/myfavourite.xml')


v =

       name: 'Google'

        url: 'http://www.google.com'

     rating: 5

description: 'Great search functionality for the web'


In the following example, we perform the same action, however, as we are specifying the additional parameter 'off' for attributes, the idx, size, and type attributes are ignored and the result is slightly different: v.rating in this case is returned as a Matlab string variable, '5'.


v = xml_load('c:/data/myfavourite.xml','off')


v =

       name: 'Google'

        url: 'http://www.google.com'

     rating: '5'

description: 'Great search functionality for the web'


See also

xml_parseany, xml_formatany, xml_format, xml_parse , xml_save, xml_help




Copyright © 2007, The Geodise Project, University of Southampton