clear all

%=================================
% Read data from an xml file and prepare a graph
%
% data_jo: data java object
% enl:     element node list
% m:       length of enl
%================================

data_jo = xmlread('data.xml');
enl = data_jo.getElementsByTagName('point');
m = enl.getLength();

for i=1:m

 parentNode = enl.item(i-1);
 parentNodeChildren = parentNode.getChildNodes;

% line breaks are counted as items:

 child1Node = parentNodeChildren.item(1);
 child2Node = parentNodeChildren.item(3);

% get string values of items

 xs(i) = child1Node.getTextContent;
 ys(i) = child2Node.getTextContent;

% convert to double precision

 x(i) = str2double(xs(i)); 
 y(i) = str2double(ys(i)); 

end

plot(x,y,'ko--')
xlabel('x')
ylabel('y')
