Beispiel #1
0
	def parse_xml(self, this_file): 
		success = 1; 
		lines = DIO.read_file(this_file); 
		components_cnt = 0; 
		for line in lines: 
			newline = DIO.strip_xml_line(line); 
		divs = DIO.parse_divs(lines); 
		new_divs = {}; 
		for div in divs: 
			if (div.strip() == "NAME"): 
				continue; 
			if (div.strip() == "DELTA"): 
				delta_lines = DIO.parse_uls(divs[div]); 
				new_divs[div] = delta_lines; 
			else: 
				new_divs[div] = divs[div]; 
			components_cnt += 1; 
		if (components_cnt != 5): 
			self.assert_dfar("REQUIRED ELEMENTS LENGTH INCORRECT", \
				components_cnt); 
			return 0; 
		self.curr_description_name = DIO.seek_name(divs); 
		if (self.notify): 
			print "NAME:", self.curr_description_name; 
		self.curr_description_struct = new_divs; 
		return success; 
Beispiel #2
0
def test_xml(): 
	test_file = "./sol_DFAs/test_dfa1.html"; 
	lines = DIO.read_file(test_file); 
	cnt = 0; 
	for line in lines: 
		newline = DIO.strip_xml_line(line); 
		#print newline, cnt; 
		cnt += 1; 
	divs = DIO.parse_divs(lines); 
	for div in divs: 
		print div, divs[div]; 
		if (div.strip() == "DELTA"): 
			delta_lines = DIO.parse_uls(divs[div]); 
			print delta_lines;
	name = DIO.seek_name(divs); 
	print "NAME:", name;