/*
 * Copyright
 *   2007 axYus - www.axyus.com
 *   2005 C.Marchand - christophe.marchand@axyus.com
 *
 * This file is part of XEMELIOS.
 *
 * XEMELIOS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * XEMELIOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with XEMELIOS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package fr.gouv.finances.cp.xemelios.controls;

import java.util.HashMap;

import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import fr.gouv.finances.cp.utils.xml.marshal.XmlMarshalParser;
import fr.gouv.finances.cp.xemelios.common.config.BlankModel;
import fr.gouv.finances.cp.xemelios.common.config.TextModel;
import fr.gouv.finances.cp.xemelios.controls.models.ControlModel;
import fr.gouv.finances.cp.xemelios.controls.models.ControlModelTech;
import fr.gouv.finances.cp.xemelios.controls.models.ControlsModel;
import fr.gouv.finances.cp.xemelios.controls.models.DocumentControlModel;
import fr.gouv.finances.cp.xemelios.controls.models.InputModel;
import fr.gouv.finances.cp.xemelios.controls.models.MessageModel;
import fr.gouv.finances.cp.xemelios.controls.models.OptionModel;
import fr.gouv.finances.cp.xemelios.controls.models.ParamModel;
import fr.gouv.finances.cp.xemelios.controls.models.ParamModelTech;
import fr.gouv.finances.cp.xemelios.controls.models.RefIdModel;
import fr.gouv.finances.cp.xemelios.controls.models.RegleModel;
import fr.gouv.finances.cp.xemelios.controls.models.SelectModel;
import javax.xml.namespace.QName;

/**
 * Parser de definition de document
 * @author chm
 */
public class ControlParser extends XmlMarshalParser {
	public ControlParser() throws SAXException, ParserConfigurationException, FactoryConfigurationError {
		super(new Mapping(),true);
	}
	
	private static class Mapping extends HashMap<QName,Class> {
		/**
		 * Comment for <code>serialVersionUID</code>
		 */
		private static final long serialVersionUID = 3617293411154145847L;

		public Mapping() {
			put(ControlsModel.QN,ControlsModel.class);
			put(ControlModel.QN,ControlModel.class);
			put(ControlModelTech.QN,ControlModelTech.class);
			put(DocumentControlModel.QN,DocumentControlModel.class);
//			put(ElementLieModel.TAG,ElementLieModel.class);
			put(MessageModel.QN,MessageModel.class);
			put(RefIdModel.QN,RefIdModel.class);
			put(ParamModel.QN,ParamModel.class);
			put(ParamModelTech.QN,ParamModelTech.class);
			put(RegleModel.QN,RegleModel.class);
			put(InputModel.QN, InputModel.class);
			put(OptionModel.QN,OptionModel.class);
			put(SelectModel.QN,SelectModel.class);
			put(BlankModel.QN,BlankModel.class);
                        //put(NamespaceModel.TAG,NamespaceModel.class);
                        //put(NSModel.TAG,NSModel.class);
			put(VALEUR,TextModel.class);
			put(LIBELLE,TextModel.class);
			put(ID,TextModel.class);
			put(SORT,TextModel.class);
			put(BR,TextModel.class);
			put(UL,TextModel.class);
			put(LI,TextModel.class);
		}
	}
        public static final transient QName VALEUR = new QName("valeur");
        public static final transient QName LIBELLE = new QName("libelle");
        public static final transient QName ID = new QName("id");
        public static final transient QName SORT = new QName("sort");
        public static final transient QName BR = new QName("br");
        public static final transient QName UL = new QName("ul");
        public static final transient QName LI = new QName("li");
                
}
