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.*;
import com.jxml.protocol.*;

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

&lt;!ELEMENT qvValidate((<a href="../../ocm/OCMsinkSupport.html#source">qvErrorContext|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;(<a href="../../ocm/OCMcontextSupport.html#factory">factory|factoryLink</a>))>

&lt;!ATTLIST qvValidate
&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

>
</pre>
 */
public class QVValidate extends OCMvalidatorSupport
{
	// 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 SubValidate(prior);
		prior.put(this,base);
		return base;
	}

	public class SubValidate extends SubValidatorSupport
	{
		public SubValidate(HashMap prior)
		{
			super(prior);
		}

		public void expressInputWithIDs()
			throws SAXException, IOException
		{
			QVErrorContext.SubErrorContext ss=(QVErrorContext.SubErrorContext)subSource;
			OCMsource.SubSource ssource=ss.subDataSource;
			((OCMsink.SubSink)ssource).expressFile(); // input with IDs added
		}
	}
}
