summaryrefslogtreecommitdiffstats
path: root/src/com/ibm/ServerWizard2/model/XmlHandler.java
blob: 0849ef5b4294ddcfc7af9076c3cbc4cdaf671daa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.ibm.ServerWizard2.model;

import java.util.ArrayList;

import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;

public class XmlHandler extends DefaultHandler {
	
	
	private ArrayList<String> warnings = new ArrayList<String>();
	
	private String detailedErrorString = "";

	public void error(SAXParseException exception) throws SAXException {
		detailedErrorString += "Line:" + exception.getLineNumber() + " , Col:" + exception.getColumnNumber() + ", Error:" + exception.getMessage() + "\n";
	}

	public void fatalError(SAXParseException exception) throws SAXException {
		detailedErrorString += "Line:" + exception.getLineNumber() + " , Col:" + exception.getColumnNumber() + ", Error:" + exception.getMessage() + "\n";
	}

	public void warning(SAXParseException exception) throws SAXException {
		warnings.add(exception.getMessage());
	}
	
	public String getDetailedErrorString(){
		return detailedErrorString;
	}
	
	public ArrayList<String> getWarnings(){
		return warnings;
	}
}
OpenPOWER on IntegriCloud