I have used blender-python to create an XML file(annotation) ,but the problem is when I use it with a Matlab code to read it, it gives me the following error:
Error in VOCxml2struct>parse (line 10)
if ~isempty(parent)&&xml(ind)~='<'
from this function :
res=[];
if ~isempty(parent)&&xml(ind)~='<'
i=findchar(xml,ind,'<');
res=trim(xml(ind:i-1));
ind=i;
[tag,ind]=gettag(xml,i);
if ~strcmp(tag,['/' parent])
error('<%s> closed with <%s>',parent,tag);
end
it's a bit confusing given that XML files from Pascal_Voc data set do work fine with the same code and when you see both XML files they look identical, I have created the required tags manually and below is my blender-python code, hopefully, there is a suggestion for me to fix it.
Thank you all for your time.
with open("000007.xml", "w", encoding="utf-8") as file:
file.write ("<annotation>\n")
file.write (" <folder>VOC2007</folder>\n")
file.write (" <filename>" + '000007.jpg' + "</filename>\n")
file.write (" <source>\n")
file.write (" <database>The VOC2007 Database</database>\n")
file.write (" <annotation>PASCAL VOC2007</annotation>\n")
file.write (" <image>flickr</image>\n")
file.write (" <flickrid>194179466</flickrid>\n")
file.write (" </source>\n")
file.write (" <owner>\n")
file.write (" <flickrid>monsieurrompu</flickrid>\n")
file.write (" <name>Thom Zemanek</name>\n")
file.write (" </owner>\n")
file.write (" </size>\n")
file.write (" <width>500</width>\n")
file.write (" <height>333</height>\n")
file.write (" <depth>3</depth>\n")
file.write (" </size>\n")
file.write (" <segmented>0</segmented>\n")
file.write (" <object>\n")
file.write (" <name>car</name>\n")
file.write (" <pose>Unspecified</pose>\n")
file.write (" <truncated>1</truncated>\n")
file.write (" <difficult>0</difficult>\n")
file.write (" <bndbox>")
file.write ("\n <xmin>" + '141' + "</xmin>")
file.write ("\n <ymin>" + '50' + "</ymin>")
file.write ("\n <xmax>" + '500' + "</xmax>")
file.write ("\n <ymax>" + '330' + "</ymax>")
file.write ("\n </bndbox>\n")
file.write (" </object>\n")
file.write ("</annotation>\n")