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

/**
 * Extracts QJML data.
 */
public class QCMQJMLError extends OCMrootPeerSupportLite 
{
	/**
	 * The output model root.
	 */
	public OCMErrorRoot qe=null;

	/**
	 * The list of errors.
	 */
	public ArrayList errors=null;

	// Implement method on OCMpeer
	public void cvt(Object param)
		throws SAXException, IOException
	{
		QMQJML qjml=(QMQJML)dataModel;
		qjml.init();
		TreeMap coinMap=qjml.coinMap;

		QMCoin rootCoin=(QMCoin)coinMap.get(qjml.root);
		if (rootCoin==null)
		{
			OCMError e=new OCMError();
			e.name="undefinedRoot";
			e.list.add(qjml);
			errors.add(e);
		}

		doCvt(coinMap,qjml);
	}

	// Override method on OCMrootPeerSupportLite
	public Object getOutputRoot()
		throws SAXException, IOException
	{
		qe=new OCMErrorRoot();
		errors=qe.errors;

		cvt(null);

		return qe;
	}
}
