// Path: src/us/pfrommer/insteon/utils/Pair.java
// public class Pair<K, V> {
// 	private K m_key;
// 	private V m_value;
// 
// 	/**
// 	 * Constructs a new <code>Pair</code> with a given key/value
// 	 * 
// 	 * @param key  the key
// 	 * @param value the value
// 	 */
// 	public Pair(K key, V value) {
// 		setKey(key);
// 		setValue(value);
// 	}
// 
// 	public K getKey() 				{ return m_key; }
// 	public V getValue() 			{ return m_value; }
// 
// 	public void setKey(K key) 		{ m_key = key; }
// 	public void setValue(V value) 	{ m_value = value; }
// }
// 
// Path: src/us/pfrommer/insteon/utils/Utils.java
// public static class DataTypeParser {
// 	public static Object s_parseDataType(DataType type, String val) {
// 		switch(type) {
// 		case BYTE: 		return s_parseByte(val);
// 		case INT:		return s_parseInt(val);
// 		case FLOAT: 	return s_parseFloat(val);
// 		case ADDRESS:	return s_parseAddress(val);
// 		default : throw new IllegalArgumentException("Data Type not implemented in Field Value Parser!");
// 		}
// 	}
// 		
// 	public static byte s_parseByte(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return (byte) Utils.from0xHexString(val.trim());
// 		} else return 0x00;
// 	}
// 	public static int s_parseInt(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return Integer.parseInt(val);
// 		} else return 0x00;
// 	}
// 	public static float s_parseFloat(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return Float.parseFloat(val.trim());
// 		} else return 0;
// 	}
// 	public static InsteonAddress s_parseAddress(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return InsteonAddress.s_parseAddress(val.trim());
// 		} else return new InsteonAddress();
// 	}
// }
// 
// Path: src/us/pfrommer/insteon/utils/Utils.java
// @SuppressWarnings("serial")
// public static class ParsingException  extends Exception { 
// 	public ParsingException(String msg) {
// 		super(msg);
// 	}
// 	public ParsingException(String msg, Throwable cause) {
// 		super(msg, cause);
// 	}
// }


import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import us.pfrommer.insteon.utils.Pair;
import us.pfrommer.insteon.utils.Utils.DataTypeParser;
import us.pfrommer.insteon.utils.Utils.ParsingException;
package us.pfrommer.insteon.msg;





/**
* Reads the Msg definitions from an XML file
* 
* @author Daniel Pfrommer
* @since 1.5.0
*/

public class XMLMessageReader {
	/**
	 * Reads the message definitions from an xml file
	 * @param input input stream from which to read
	 * @return what was read from file: the map between clear text string and Msg objects
	 * @throws IOException couldn't read file etc
	 * @throws ParsingException something wrong with the file format
	 * @throws FieldException something wrong with the field definition
	 */
	public static HashMap<String, Msg> s_readMessageDefinitions(InputStream input)
// Path: src/us/pfrommer/insteon/utils/Pair.java
// public class Pair<K, V> {
// 	private K m_key;
// 	private V m_value;
// 
// 	/**
// 	 * Constructs a new <code>Pair</code> with a given key/value
// 	 * 
// 	 * @param key  the key
// 	 * @param value the value
// 	 */
// 	public Pair(K key, V value) {
// 		setKey(key);
// 		setValue(value);
// 	}
// 
// 	public K getKey() 				{ return m_key; }
// 	public V getValue() 			{ return m_value; }
// 
// 	public void setKey(K key) 		{ m_key = key; }
// 	public void setValue(V value) 	{ m_value = value; }
// }
// 
// Path: src/us/pfrommer/insteon/utils/Utils.java
// public static class DataTypeParser {
// 	public static Object s_parseDataType(DataType type, String val) {
// 		switch(type) {
// 		case BYTE: 		return s_parseByte(val);
// 		case INT:		return s_parseInt(val);
// 		case FLOAT: 	return s_parseFloat(val);
// 		case ADDRESS:	return s_parseAddress(val);
// 		default : throw new IllegalArgumentException("Data Type not implemented in Field Value Parser!");
// 		}
// 	}
// 		
// 	public static byte s_parseByte(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return (byte) Utils.from0xHexString(val.trim());
// 		} else return 0x00;
// 	}
// 	public static int s_parseInt(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return Integer.parseInt(val);
// 		} else return 0x00;
// 	}
// 	public static float s_parseFloat(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return Float.parseFloat(val.trim());
// 		} else return 0;
// 	}
// 	public static InsteonAddress s_parseAddress(String val) {
// 		if (val != null && !val.trim().equals("")) {
// 			return InsteonAddress.s_parseAddress(val.trim());
// 		} else return new InsteonAddress();
// 	}
// }
// 
// Path: src/us/pfrommer/insteon/utils/Utils.java
// @SuppressWarnings("serial")
// public static class ParsingException  extends Exception { 
// 	public ParsingException(String msg) {
// 		super(msg);
// 	}
// 	public ParsingException(String msg, Throwable cause) {
// 		super(msg, cause);
// 	}
// }


// Path: src/us/pfrommer/insteon/msg/XMLMessageReader.java
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import us.pfrommer.insteon.utils.Pair;
import us.pfrommer.insteon.utils.Utils.DataTypeParser;
import us.pfrommer.insteon.utils.Utils.ParsingException;

package us.pfrommer.insteon.msg;





/**
* Reads the Msg definitions from an XML file
* 
* @author Daniel Pfrommer
* @since 1.5.0
*/

public class XMLMessageReader {
	/**
	 * Reads the message definitions from an xml file
	 * @param input input stream from which to read
	 * @return what was read from file: the map between clear text string and Msg objects
	 * @throws IOException couldn't read file etc
	 * @throws ParsingException something wrong with the file format
	 * @throws FieldException something wrong with the field definition
	 */
	public static HashMap<String, Msg> s_readMessageDefinitions(InputStream input)
				throws IOException, ParsingException, FieldException {