+ node = xml.dom.minidom.parse(sys.argv[2])
+ xml_filename = sys.argv[3]
+ real_filename = sys.argv[4]
+
+ for path_comp in xml_filename.split('/'):
+ if ' ' in path_comp:
+ i = int(path_comp.split(' ', 1)[0])
+ node = _get_child_node(node, i)
+ elif path_comp == 'attributes':
+ break
+ else:
+ xml_error('Unknown file')
+
+ if path_comp == 'attributes':
+ attrs = node.attributes
+ if attrs:
+ text = _attrs2text(attrs)
+ else:
+ xml_error('There are no attributes')
+
+ outfile = open(real_filename, 'w')
+ outfile.write(text)
+ outfile.close()
+