package com.jxml.quick.util.qjml2qiml;
import com.jxml.quick.model.qjml.*;
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import com.jxml.quick.ocm.*;
import java.io.*;

/**
 * Extracts QJML data.
 */
public class QCField extends OCMpeerSupport
{
	/**
	 * User-provided code to perform the conversion.
	 */
	public void cvt(Object param)
		throws SAXException, IOException
	{
		QMField dm=(QMField)dataModel;

		if (dm.size!=-1)
			throw new SAXException("field does not support size: "+dm.size);
		if (dm.keyAccess!=null)
			throw new SAXException("field does not support key: "+dm.key);

		if ("".equals(dm.kind))
		{
			startElement("accessField");
			addStringContent(dm.name);
			endElement("accessField");
		}
		else if ("list".equals(dm.kind))
		{
			startElement("accessListField");
			addStringContent(dm.name);
			endElement("accessListField");
		}
		else if ("map".equals(dm.kind))
		{
			startElement("accessMapField");
			addStringContent(dm.name);
			endElement("accessMapField");
		}
		else
			throw new SAXException("field does not support kind: "+dm.kind);
	}
}
