package com.jxml.quick.util.qjml2html;
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.*;


public class QCBean extends QCCoin
{
	StringBuffer sb;
	public QMBean ed;
	Map atts;
	public void cvt(Object param) 
		throws SAXException, IOException 
	{
		OCMcontextSupport.SubContextSupport scs=(OCMcontextSupport.SubContextSupport)context;
		sb=scs.sb;
		ed=(QMBean)dataModel;
		if (param==null)
			super.cvt(ed);
		else
		{
			remList=ed.remList;
			int s=remList.size();
			for(int i=0;i<s;i++)
			{
				sb.append(((QMRem)remList.get(i)).getQText());
			}
		}
	}

	public String process(String templateName, String arg)
		throws SAXException, IOException
	{
		if("elementName".equals(arg))
		{
			return ed.tag;
		}	
	
		if("attributes".equals(arg))
		{	
			atts=ed.getAtts();
			if (atts.size()>0)
			{
				doCvt(ed.attributes,"");
			}

			return "";	
		}

		if("contents".equals(arg))
		{	
			if(ed.elements!=null)
			{
				doCvt(ed.elements,"");
			}
			return "";
		}

		return	super.process(templateName,arg);

	}
}

