package com.jxml.quick.util.validate;
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import com.jxml.quick.ocm.*;
import java.io.*;

/**
 * Validates a document against the qdml schema.
<pre>
DTD:

&lt;!ELEMENT qvErrorContext((<a href="../../ocm/OCMsinkSupport.html#source">source|sourceLink</a>),(<a href="#dataSource">source|sourceLink</a>),(<a href="../../ocm/OCMsinkSupport.html#validator">validate|validateLink</a>)?,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<a href="../../ocm/OCMcontextSupport.html#factory">factory|factoryLink</a>))>

&lt;!ATTLIST qvErrorContext
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../ocm/OCMsinkSupport.html#prefix">docNamePrefix </a>CDATA #IMPLIED
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../ocm/OCMsinkSupport.html#expressDefaults">expressDefaults</a> CDATA "False"
&nbsp;&nbsp;&nbsp;&nbsp;ID CDATA #IMPLIED
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../ocm/OCMtranscribe.html#schemaName">outputSchema</a> CDATA #IMPLIED
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#qdmlSchemaName">qdmlSchema</a> CDATA #IMPLIED

>
</pre>
 */
public class QVErrorContext extends OCMcontextSupport
{
	public String qdmlSchemaName="";

	public OCMsource dataSource=null;

	// implements an OCMbase method
	public OCMbase.SubBase spawn(HashMap prior)
	{
		OCMbase.SubBase rv=(OCMbase.SubBase)prior.get(this);
		if (rv!=null)
			return rv;
		OCMbase.SubBase base=new SubErrorContext(prior);
		prior.put(this,base);
		return base;
	}

	public class SubErrorContext extends SubContextSupport
	{
		public OCMsource.SubSource subDataSource=null;

		public SubErrorContext(HashMap prior)
		{
			super(prior);
			subDataSource=(OCMsource.SubSource)dataSource.spawn(prior);
		}
		public void setInputDocName(Object inputName)
			throws SAXException, IOException
		{
			if ("".equals(docName) && !"".equals(prefix))
				docName=prefix+(genNbr++);
			subSource.setInputDocName(qdmlSchemaName);
			subDataSource.setInputDocName(inputName);
		}
	}
}
