package org.geotools.wms.v1_1_1.bindings;


import java.util.Map;

import javax.xml.namespace.QName;

import org.geotools.data.ows.Layer;
import org.geotools.data.ows.Service;
import org.geotools.data.ows.WMSCapabilities;
import org.geotools.data.ows.WMSRequest;
import org.geotools.xml.AbstractComplexBinding;
import org.geotools.xml.ElementInstance;
import org.geotools.xml.Node;

/**
 * Binding object for the type :_WMT_MS_Capabilities.
 *
 * <p>
 *	<pre>
 *	 <code>
 *  &lt;xs:complexType name="_WMT_MS_Capabilities"&gt;
 *      &lt;xs:sequence&gt;
 *          &lt;xs:element ref="Service"/&gt;
 *          &lt;xs:element ref="Capability"/&gt;
 *      &lt;/xs:sequence&gt;
 *      &lt;xs:attribute default="1.1.1" name="version"&gt;
 *          &lt;xs:simpleType&gt;
 *              &lt;xs:restriction base="xs:string"&gt;
 *                  &lt;xs:enumeration value="1.1.1"/&gt;
 *              &lt;/xs:restriction&gt;
 *          &lt;/xs:simpleType&gt;
 *      &lt;/xs:attribute&gt;
 *      &lt;xs:attribute name="updateSequence"/&gt;
 *  &lt;/xs:complexType&gt; 
 *		
 *	  </code>
 *	 </pre>
 * </p>
 *
 * @generated
 */
public class _WMT_MS_CapabilitiesBinding extends AbstractComplexBinding {

	/**
	 * @generated
	 */
	public QName getTarget() {
		return WMSV1_1_1._WMT_MS_Capabilities;
	}
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 *	
	 * @generated modifiable
	 */	
	public Class getType() {
		return WMSCapabilities.class;
	}
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 *	
	 * @generated modifiable
	 */	
	public Object parse(ElementInstance instance, Node node, Object value) 
		throws Exception {
		WMSCapabilities ret = new WMSCapabilities();
		
		// These come from the _CapabilityBinding
		Map caps = (Map)node.getChildValue("Capability");
		ret.setLayer((Layer)caps.get("Layer"));
		ret.setRequest((WMSRequest)caps.get("Request"));
		ret.setExceptions((String[]) caps.get("Exception"));
		
		ret.setService((Service)node.getChildValue("Service"));
		ret.setVersion((String)node.getAttributeValue("version"));
		ret.setUpdateSequence((String)node.getAttributeValue("updateSequence"));
		
		return ret;
		
	}

}