package com.jxml.quick.ocm; // Open Conversion Model
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import java.io.*;

/**
 * Maps data model tags to peer classes.
<pre>
DTD:

&lt;!ELEMENT FactoryByTag(<a href="OCMpeerFactorySupport.html#pairs">(tagName,peerClass)+</a>)>

&lt;!ATTLIST FactoryByTag
&nbsp;&nbsp;&nbsp;&nbsp;<a href="OCMpeerFactorySupport.html#defaultClass">defaultPeerClass</a> CDATA #IMPLIED
&nbsp;&nbsp;&nbsp;&nbsp;ID CDATA #IMPLIED
>
</pre>
 */
public class OCMpeerFactoryMapByTag  extends OCMpeerFactoryMap
{

	/**
	 * Return a peer object.
	 */
	public OCMpeer createPeer(Object dataModel, OCMcontext context, OCMpeer parent)
		throws SAXException, IOException
	{
		OCMelement elem=(OCMelement)dataModel;
		if (dataModel==null)
			return null;
		if (elem==null)
			return null;
		String key=elem.getQName();
		OCMpeerFactoryEntry entry=(OCMpeerFactoryEntry)entries.get(key);
		if (entry==null)
			return null;
		return entry.createPeer(dataModel,context,parent);
	}
}
