MATLAB: Hello sir, i want to get the ‘sky’ from the sky and ‘building’ from the building from the following xml file. i want to get these two as text files.

text from xml file

<annotation>
<filename>sun_aaafxrsrnpincanu.jpg</filename>
<folder>a/apartment_building/outdoor</folder>
<source>
<sourceImage>The MIT-CSAIL database of objects and scenes</sourceImage>
<sourceAnnotation>LabelMe Webtool</sourceAnnotation>
</source>
<object>
<name>sky</name>
<deleted>0</deleted>
<verified>0</verified>
<date>28-May-2010 13:28:13</date>
<id>0</id>
<polygon>
<username>admin</username>
<pt>
<x>0</x>
<y>0</y>
</pt>
<pt>
<x>2</x>
<y>958</y>
</pt>
<pt>
<x>69</x>
<y>958</y>
</pt>
<pt>
<x>380</x>
<y>48</y>
</pt>
<pt>
<x>811</x>
<y>73</y>
</pt>
<pt>
<x>826</x>
<y>97</y>
</pt>
<pt>
<x>941</x>
<y>108</y>
</pt>
<pt>
<x>945</x>
<y>80</y>
</pt>
<pt>
<x>1064</x>
<y>89</y>
</pt>
<pt>
<x>1279</x>
<y>240</y>
</pt>
<pt>
<x>1277</x>
<y>0</y>
</pt>
</polygon>
</object>
<object>
<name>building</name>
<deleted>0</deleted>
<verified>0</verified>
<date>28-May-2010 13:28:13</date>
<id>1</id>
<polygon>
<username>admin</username>
<pt>
<x>1277</x>
<y>956</y>
</pt>
<pt>
<x>1279</x>
<y>242</y>
</pt>
<pt>
<x>1063</x>
<y>86</y>
</pt>
<pt>
<x>945</x>
<y>76</y>
</pt>
<pt>
<x>941</x>
<y>110</y>
</pt>
<pt>
<x>824</x>
<y>99</y>
</pt>
<pt>
<x>811</x>
<y>71</y>
</pt>
<pt>
<x>378</x>
<y>45</y>
</pt>
<pt>
<x>67</x>
<y>958</y>
</pt>
</polygon>
</object>
<imagesize>
<nrows>960</nrows>
<ncols>1280</ncols>
</imagesize>
</annotation>

Best Answer