clear all

%----
polygons_jo = xmlread('polygons_inp.xml');
enl = polygons_jo.getElementsByTagName('polygon');   % element node list
m = enl.getLength();
%----

n=200;
while (n>5)
  n = input('Please enter the number of sides (less than 6): ');
end

%----
for i=1:m

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

% line breaks are counted as items:

 sidesNode = parentNodeChildren.item(1);
 nameNode  = parentNodeChildren.item(3);

% get string values of items

 test_sides = str2double(sidesNode.getTextContent);
 test_name = nameNode.getTextContent;

 if(n==test_sides)
    disp(test_name)
    break
 end

end
%----

