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 QCBean extends OCMpeerSupport
{
	public boolean beenHere=false;

	/**
	 * User-provided code to perform the conversion.
	 */
	public void cvt(Object param)
		throws SAXException, IOException
	{
		QMBean dm=(QMBean)dataModel;

		if (beenHere)
		{
			addStringAttribute("href","#"+dm.getLabel());
			//addStringAttribute("schema","http://www.jxml.com/qiml.qiml");
			emptyElement("link");
			return;
		}
		beenHere=true;

		addStringAttribute("tagName",dm.getTag());
		addStringAttribute("ID",dm.getLabel());
		if (dm.wild)
			addStringAttribute("wild","True");
		if ("BIMODAL".equals(dm.type))
			addStringAttribute("bimodal","True");

		startElement("elementDefinition");

		doCvt(dm.remList,null);
		doCvt(dm.target,null); // null: no data
		doCvt(dm.extensions,null);
		doCvt(dm.implementations,null);
		doCvt(dm.attributes,null);
		doCvt(dm.elements,null);

		endElement("elementDefinition");
	}
}
