// This class was generated by the JAXRPC SI, do not edit.
// Contents subject to change without notice.
// JAX-RPC Standard Implementation (1.1.2, build R23)
// Generated source version: 1.1.2

package org.tempuri.sample;

import com.sun.xml.rpc.encoding.*;
import com.sun.xml.rpc.encoding.literal.DetailFragmentDeserializer;
import com.sun.xml.rpc.encoding.simpletype.*;
import com.sun.xml.rpc.encoding.soap.SOAPConstants;
import com.sun.xml.rpc.encoding.soap.SOAP12Constants;
import com.sun.xml.rpc.streaming.*;
import com.sun.xml.rpc.wsdl.document.schema.SchemaConstants;
import javax.xml.namespace.QName;

public class PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct_SOAPSerializer extends ObjectSerializerBase implements Initializable {
    private static final QName ns1_return_QNAME = new QName("", "return");
    private static final QName ns2_results_TYPE_QNAME = new QName("http://dietrich.ganx4.com/", "results");
    private CombinedSerializer ns2_myResults_SOAPSerializer;
    private static final int my_RETURN_INDEX = 0;
    
    public PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct_SOAPSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle) {
        super(type, encodeType, isNullable, encodingStyle);
    }
    
    public void initialize(InternalTypeMappingRegistry registry) throws Exception {
        ns2_myResults_SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, org.tempuri.sample.Results.class, ns2_results_TYPE_QNAME);
    }
    
    public Object doDeserialize(SOAPDeserializationState state, XMLReader reader,
        SOAPDeserializationContext context) throws Exception {
        org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct instance = new org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct();
        org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct_SOAPBuilder builder = null;
        Object member;
        boolean isComplete = true;
        QName elementName;
        
        reader.nextElementContent();
        elementName = reader.getName();
        if (reader.getState() == XMLReader.START) {
            if (elementName.equals(ns1_return_QNAME)) {
                member = ns2_myResults_SOAPSerializer.deserialize(ns1_return_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, my_RETURN_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.set_return((org.tempuri.sample.Results)member);
                }
                reader.nextElementContent();
            } else {
                throw new DeserializationException("soap.unexpectedElementName", new Object[] {ns1_return_QNAME, elementName});
            }
        }
        
        XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
        return (isComplete ? (Object)instance : (Object)state);
    }
    
    public void doSerializeAttributes(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct instance = (org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct)obj;
        
    }
    
    public void doSerializeInstance(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct instance = (org.tempuri.sample.PresidentialElectionResults2004PortType_whoisgoingtobepresident_ResponseStruct)obj;
        
        ns2_myResults_SOAPSerializer.serialize(instance.get_return(), ns1_return_QNAME, null, writer, context);
    }
    protected void verifyName(XMLReader reader, QName expectedName) throws Exception {
    }
}
