public void startElement()

in mustella/src/main/java/marmotinni/MarmotinniRunner.java [121:181]


	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
		if (verboseXMLParsing)
			System.out.println("StartElement: uri: " + uri + "localName: " + localName + "qName: " + qName);
		if(qName.equalsIgnoreCase("UnitTester")) {
			// this should be the top-level tag, just ignore for now.  Will need to process script subtags later
		}
		else if (qName.length() == 0)
		{
			// there seems to be some empty tags
		}
		else if (qName.equalsIgnoreCase("testCases"))
		{
			// there seems to be some empty tags
		}
		else if (qName.equalsIgnoreCase("mx:Script"))
		{
			// there seems to be some empty tags
		}
		else if (qName.equalsIgnoreCase("mx:Metadata"))
		{
			// there seems to be some empty tags
		}
		else if (qName.equalsIgnoreCase("TestCase")) {
			testCase = new TestCase();
			testCase.populateFromAttributes(attributes);
			tests.add(testCase);
		}
		else if (tagMap.containsKey(qName)) {
			Class<?> c = tagMap.get(qName);
			try {
				TestStep testStep = (TestStep)c.newInstance(); 
				testStep.populateFromAttributes(attributes);
				if (currentPhase.equals("setup"))
					testCase.setup.add(testStep);
				else if (currentPhase.equals("body"))
					testCase.body.add(testStep);
				else
					testCase.cleanup.add(testStep);
			}
			catch (Exception e) {
				System.out.println(e.getMessage());
				return;
			}
		}
		else if (qName.equals("setup")) {
			currentPhase = "setup";
			testCase.setup = new ArrayList<TestStep>();
		}
		else if (qName.equals("body")) {
			currentPhase = "body";
			testCase.body = new ArrayList<TestStep>();
		}
		else if (qName.equals("cleanup")) {
			currentPhase = "cleanup";
			testCase.cleanup = new ArrayList<TestStep>();
		}
		else {
			System.out.println("unexpected element: " + uri + qName);
		}

	}