// !DO NOT EDIT THIS FILE!
// This source file is generated by Oracle tools
// Contents may be subject to change
// For reporting problems, use the following
// Version = Oracle WebServices (10.1.3.3.0, build 070610.1800.23513)

package xqueryws.proxy.runtime;

import oracle.j2ee.ws.common.encoding.*;
import oracle.j2ee.ws.common.encoding.literal.*;
import oracle.j2ee.ws.common.encoding.literal.DetailFragmentDeserializer;
import oracle.j2ee.ws.common.encoding.simpletype.*;
import oracle.j2ee.ws.common.soap.SOAPEncodingConstants;
import oracle.j2ee.ws.common.soap.SOAPEnvelopeConstants;
import oracle.j2ee.ws.common.soap.SOAPVersion;
import oracle.j2ee.ws.common.streaming.*;
import oracle.j2ee.ws.common.wsdl.document.schema.SchemaConstants;
import oracle.j2ee.ws.common.util.xml.UUID;
import javax.xml.namespace.QName;
import java.util.List;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.AttachmentPart;

public class Bind_LiteralSerializer extends LiteralObjectSerializerBase implements Initializable {
    private static final QName ns1_name_QNAME = new QName("", "name");
    
    public Bind_LiteralSerializer(QName type) {
        this(type,  false);
    }
    
    public Bind_LiteralSerializer(QName type, boolean encodeType) {
        super(type, true, encodeType);
        setSOAPVersion(SOAPVersion.SOAP_11);
    }
    
    public void initialize(InternalTypeMappingRegistry registry) throws Exception {
    }
    
    public java.lang.Object doDeserialize(XMLReader reader,
        SOAPDeserializationContext context) throws Exception {
        xqueryws.proxy.Bind instance = new xqueryws.proxy.Bind();
        java.lang.Object member=null;
        QName elementName;
        List values;
        java.lang.Object value;
        
        Attributes attributes = reader.getAttributes();
        String attribute = null;
        attribute = attributes.getValue(ns1_name_QNAME);
        if (attribute != null) {
            member = XSDStringEncoder.getInstance().stringToObject(attribute, reader);
            instance.setName((java.lang.String)member);
        }
        
        reader.nextContent();
        if (reader.getState() == XMLReader.CHARS) {
            if (!reader.hasBinaryValue()) {
                member = XSDStringEncoder.getInstance().stringToObject(reader.getValue(), reader);
            }
            else {
                member = ((XSDBase64BinaryEncoder)XSDBase64BinaryEncoder.getInstance()).deserializeFromMTOM(reader);
            }
            reader.nextContent();
        }
        else if (reader.getState() == XMLReader.END) {
            member = XSDStringEncoder.getInstance().stringToObject("", reader);
        }
        else if (reader.getState() == XMLReader.START) {
            throw new DeserializationException("literal.simpleContentExpected", new java.lang.Object[] {reader.getName()},DeserializationException.FAULT_CODE_CLIENT);
        }
        instance.set_value((java.lang.String)member);
        if( reader.getState() != XMLReader.END)
        {
            reader.skipElement();
        }
        XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
        return (java.lang.Object)instance;
    }
    
    public void doSerializeAttributes(java.lang.Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        xqueryws.proxy.Bind instance = (xqueryws.proxy.Bind)obj;
        
        if( instance.getName() != null )
        writer.writeAttribute(ns1_name_QNAME, XSDStringEncoder.getInstance().objectToString(instance.getName(), writer));
    }
    public void doSerializeAnyAttributes(java.lang.Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        xqueryws.proxy.Bind instance = (xqueryws.proxy.Bind)obj;
        
    }
    public void doSerialize(java.lang.Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        xqueryws.proxy.Bind instance = (xqueryws.proxy.Bind)obj;
        
        writer.writeChars(XSDStringEncoder.getInstance().objectToString(instance.get_value(), writer));
    }
}
