function xml2struct_test ( )

%*****************************************************************************80
%
%% xml2struct_test() tests xml2struct().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 January 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'xml2struct_test():\n' );
  fprintf ( 1, '  xml2struct() converts the information in an XML file\n' );
  fprintf ( 1, '  to a MATLAB structure.\n' );
%
%  Specify the XML file to be read.
%
  filename = 'books.xml';
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Read data from "%s"\n', filename );
  fprintf ( 1, '\n' );
%
%  Create a structure from the information in the XML file.
%
  data = xml2struct ( filename );
%
%  If we already know the structure of the data, we can reference items directly.
%  The "Text" item is a string.
%
  price = str2num ( data.catalog.book{1,2}.price.Text );
  fprintf ( 1, '  Price of book #2 is %g\n', price );

  author = data.catalog.book{1,1}.author.Text;
  fprintf ( 1, '  Author of book #1 is "%s"\n', author );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'xml2struct_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

