function xmlUnitTest
% xmlUnitTest - simple verification of module xml.m with various example
%               xml files.

%extractapplic('xmlUnitTest')

if 0
    parsequeryString
    serializeDOM
    struct2xmlstr
end
    
%create an xml from a Matlab structure
obj = xml(struct('a',1));
disp('struct test OK')
rt.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z=1;
obj = xml(rt);
disp('struct 2 test OK')

%  %create an xml directly from a string
str = '<book category="MATHS"><title lang="en">Nonlinear Programming</title><author>Dimitri P. Bertsekas</author></book>';
obj = xml(str);
disp('string test OK')

%Run tests on example files
pth=fullfile(xmlpath,'examples');
s=dir(fullfile(pth,'*.xml'));
for k=1:length(s)
    %create an xml from a sourcefile
    obj=xml(fullfile(pth,s(k).name));
    %create an xml from a java sourcefile handle
    obj=xml(java.io.File(fullfile(pth,s(k).name)));
    %create an xml directly from an inputstream
    obj = xml(java.io.FileInputStream((fullfile(pth,s(k).name))));

    disp(sprintf('Read test %s OK',s(k).name));
end

%create an xml from a sourcefile and validate against a xsd (specified
%in the xml itself
obj = xml(fullfile(pth,'cd_catalog.xml'));
xslt(obj,fullfile(pth,'cd_catalog.xsl'));
disp('xslt test OK');
disp('all tests OK');
