Ejemplo n.º 1
0
        private void ProcessAttributes(ParseRecord pr, ParseRecord objectPr)
        {
            InternalST.Soap( this, "ProcessAttributes Entry ",pr.Trace()," headerState ",((Enum)headerState).ToString());
            String keyPosition = null;
            String keyOffset = null;
            String keyMustUnderstand = null;

            pr.PRisProcessAttributes = true;

            String SoapKeyUrl = "http://schemas.xmlsoap.org/soap/encoding/";
            int SoapKeyUrlLength = SoapKeyUrl.Length;
            String UrtKeyUrl = "http://schemas.microsoft.com/clr/id";
            int UrtKeyUrlLength = UrtKeyUrl.Length;
            String SoapEnvKeyUrl = "http://schemas.xmlsoap.org/soap/envelope/";
            int SoapEnvKeyUrlLength = SoapEnvKeyUrl.Length;
            String XSIKey2001 = "http://www.w3.org/2001/XMLSchema-instance";
            int XSIKey2001Length = XSIKey2001.Length;
            String XSIKey2000 = "http://www.w3.org/2000/10/XMLSchema-instance";
            int XSIKey2000Length = XSIKey2000.Length;
            String XSIKey1999 = "http://www.w3.org/1999/XMLSchema-instance";
            int XSIKey1999Length = XSIKey1999.Length;

            String XSDKey1999 = "http://www.w3.org/1999/XMLSchema";
            int XSDKey1999Length = XSDKey1999.Length;
            String XSDKey2000 = "http://www.w3.org/2000/10/XMLSchema";
            int XSDKey2000Length = XSDKey2000.Length;
            String XSDKey2001 = "http://www.w3.org/2001/XMLSchema";
            int XSDKey2001Length = XSDKey2001.Length;
            String clrNS = "http://schemas.microsoft.com/soap/encoding/clr/1.0";
            int clrNSLength = clrNS.Length;

            for (int i = 0; i<attributeValues.Count(); i++)
            {
                AttributeValueEntry attributeValueEntry = (AttributeValueEntry)attributeValues.GetItem(i);
                String prefix = attributeValueEntry.prefix;
                String key = attributeValueEntry.key;
                if ((key == null) || (key.Length == 0))
                    key = pr.PRnameXmlKey; //case where there is a default key
                String value = attributeValueEntry.value;
                bool prefixMatchesXmlns = false;
                String urn = attributeValueEntry.urn;
                InternalST.Soap( this, "ProcessAttributes attribute prefix ",prefix," key ",key," value ",value," urn ", urn);

                int keyLength = key.Length;
                int valueLength = value.Length;
                // table need for QName xsd types
                if (key == null || keyLength == 0)
                    keyToNamespaceTable[prefix] = value;
                else
                    keyToNamespaceTable[prefix+":"+key] = value;

                if (keyLength == 2 && String.Compare(key, "id", true, CultureInfo.InvariantCulture) == 0)
                    pr.PRobjectId = objectReader.GetId(value);
                else if (keyLength == 8 && String.Compare(key, "position", true, CultureInfo.InvariantCulture) == 0)
                    keyPosition = value;
                else if (keyLength == 6 && String.Compare(key, "offset", true, CultureInfo.InvariantCulture) == 0)
                    keyOffset = value;
                else if (keyLength == 14 && String.Compare(key, "MustUnderstand", true, CultureInfo.InvariantCulture) == 0)
                    keyMustUnderstand = value;
                else if (keyLength == 4 && String.Compare(key, "null", true, CultureInfo.InvariantCulture) == 0)
                {
                    pr.PRmemberValueEnum = InternalMemberValueE.Null;
                    pr.PRvalue = null;
                }
                else if (keyLength == 4 && String.Compare(key, "root", true, CultureInfo.InvariantCulture) == 0)
                {
                    if (value.Equals("1"))
                        pr.PRisHeaderRoot = true;
                }
                else if (keyLength == 4 && String.Compare(key, "href", true, CultureInfo.InvariantCulture) == 0)
                    pr.PRidRef = objectReader.GetId(value);
                else if (keyLength == 4 && String.Compare(key, "type", true, CultureInfo.InvariantCulture) == 0)
                {
                    String currentPRtypeXmlKey = pr.PRtypeXmlKey;
                    String currentPRkeyDt = pr.PRkeyDt;
                    Type currentPRdtType = pr.PRdtType;

                    String typeValue = value;
                    int index = value.IndexOf(":");
                    if (index > 0)
                    {
                        pr.PRtypeXmlKey = value.Substring(0, index);
                        typeValue = value.Substring(++index);
                    }
                    else
                    {
                        pr.PRtypeXmlKey = prefix;                       
                    }

                    if (String.Compare(typeValue, "anyType", true, CultureInfo.InvariantCulture) == 0 || String.Compare(typeValue, "ur-type", true, CultureInfo.InvariantCulture) == 0)
                    {
                        pr.PRkeyDt = "System.Object";
                        pr.PRdtType = SoapUtil.typeofObject;
                        pr.PRtypeXmlKey = urtKey;
                    }

                    if (pr.PRtypeXmlKey == soapKey && typeValue == "Array") //Don't need to process xsi:type="SOAP-ENC:Array"
                    {
                        // Array values already found,use these value rather then the xsi:type values
                        pr.PRtypeXmlKey = currentPRtypeXmlKey;
                        pr.PRkeyDt = currentPRkeyDt;
                        pr.PRdtType = currentPRdtType;
                        InternalST.Soap( this,"ProcessAttributes, xsi:type='SOAP-ENC:Array' pr.PRtypeXmlKey ", pr.PRtypeXmlKey," pr.PRkeyDt "+pr.PRkeyDt);
                    }
                    else
                    {
                        pr.PRkeyDt = typeValue;
                        InternalST.Soap( this,"ProcessAttributes, not  xsi:type='SOAP-ENC:Array' pr.PRtypeXmlKey ", pr.PRtypeXmlKey," pr.PRkeyDt "+pr.PRkeyDt);
                    }
                }
                else if (keyLength == 9 && String.Compare(key, "arraytype", true, CultureInfo.InvariantCulture) == 0)
                {
                    String typeValue = value;
                    int index = value.IndexOf(":");
                    if (index > 0)
                    {
                        pr.PRtypeXmlKey = value.Substring(0, index);
                        pr.PRkeyDt = typeValue = value.Substring(++index);
                    }

                    if (typeValue.StartsWith("ur_type["))
                    {
                        pr.PRkeyDt = "System.Object"+typeValue.Substring(6);
                        pr.PRtypeXmlKey = urtKey;
                    }
                }
                else if (SoapServices.IsClrTypeNamespace(value))
                {
                    if (!assemKeyToAssemblyTable.ContainsKey(key))
                    {
                        String typeNamespace = null;
                        String assemblyName = null;
                        SoapServices.DecodeXmlNamespaceForClrTypeNamespace(value, out typeNamespace, out assemblyName);
                        if (assemblyName == null)
                        {
                            assemKeyToAssemblyTable[key] = new SoapAssemblyInfo(SoapUtil.urtAssemblyString, SoapUtil.urtAssembly);
                            assemKeyToNameSpaceTable[key] = typeNamespace;
                        }
                        else
                        {
                            assemKeyToAssemblyTable[key] = new SoapAssemblyInfo(assemblyName);
                            if (typeNamespace != null)
                                assemKeyToNameSpaceTable[key] = typeNamespace;
                        }

                    }
                }
                else if ((prefixMatchesXmlns = prefix.Equals("xmlns")) && (valueLength == SoapKeyUrlLength && String.Compare(value, SoapKeyUrl, true, CultureInfo.InvariantCulture) == 0))
                {
                    soapKey = key;
                }
                else if (prefixMatchesXmlns && (valueLength == UrtKeyUrlLength && String.Compare(value, UrtKeyUrl, true, CultureInfo.InvariantCulture) == 0))
                {
                    urtKey = key;
                    assemKeyToAssemblyTable[urtKey] = new SoapAssemblyInfo(SoapUtil.urtAssemblyString, SoapUtil.urtAssembly);
                }
                else if (prefixMatchesXmlns && (valueLength == SoapEnvKeyUrlLength && String.Compare(value, SoapEnvKeyUrl, true) == 0))
                {
                    soapEnvKey = key;
                }
                else if (key == "encodingStyle")
                {
                    /*
                    String[] split = value.Split(' ');
                    foreach (String s in split)
                    {
                        if (s == "http://schemas.microsoft.com/soap/encoding/clr/1.0")
                        {
                            objectReader.SetVersion(1,0);
                            break;
                        }
                    }
                    */
                }
                else if (prefixMatchesXmlns && 
                         ((valueLength == XSIKey2001Length && String.Compare(value, XSIKey2001,true, CultureInfo.InvariantCulture) == 0) ||
                          (valueLength == XSIKey1999Length && String.Compare(value, XSIKey1999,true, CultureInfo.InvariantCulture) == 0) ||
                          (valueLength == XSIKey2000Length && String.Compare(value, XSIKey2000,true, CultureInfo.InvariantCulture) == 0)))
                {
                    xsiKey = key;
                }
                else if (prefixMatchesXmlns && 
                         ((valueLength == XSDKey2001Length && String.Compare(value, XSDKey2001 , true, CultureInfo.InvariantCulture) == 0)) ||
                         (valueLength == XSDKey1999Length && String.Compare(value, XSDKey1999, true, CultureInfo.InvariantCulture) == 0) ||
                         (valueLength == XSDKey2000Length && String.Compare(value, XSDKey2000, true, CultureInfo.InvariantCulture) == 0))
                {
                    xsdKey = key;
                }
                else if (prefixMatchesXmlns && (valueLength == clrNSLength && String.Compare(value, clrNS, true, CultureInfo.InvariantCulture) == 0))
                {
                    objectReader.SetVersion(1,0);
                }
                else
                {
                    //String lowerCaseValue = value.ToLower(CultureInfo.InvariantCulture);
                    if (prefixMatchesXmlns)
                    {
                        // Assume it is an interop namespace
                        assemKeyToInteropAssemblyTable[key] = value;                        
                        InternalST.Soap( this,"ProcessAttributes, InteropType key "+key+" value ",value);
                    }
                    else if (String.Compare(prefix, soapKey, true, CultureInfo.InvariantCulture) == 0)
                    {
                        InternalST.Soap( this,"ProcessAttributes, Not processed key ",prefix,":",key," = ",value);                  
                    }
                    else
                    {
                        // See if it is a XmlAttribute
                        InternalST.Soap( this,"ProcessAttributes, XmlAttribute prefix ",prefix," key ",key," value ",value," urn ",urn, " hashtable ",assemKeyToInteropAssemblyTable[prefix]);

                        if ((assemKeyToInteropAssemblyTable.ContainsKey(prefix)) && ((String)assemKeyToInteropAssemblyTable[prefix]).Equals(urn))
                        {
                            ProcessXmlAttribute(prefix, key, value, objectPr);
                        }
                        else
                        {
                            InternalST.Soap( this,"ProcessAttributes, Not processed prefix ",prefix," key ",key," value ",value," urn ",urn);
                        }
                    }
                }
            }

            attributeValues.Clear();

            // reset the header state
            // If no headers then headerState is None
            //
            // if parent is a header section then these are top level objects
            // within the header section. If the object has a root set
            // then it is a header record, if not then it is a toplevel object
            // in the header section which is not a header record.
            //
            // if the parent is not a header section and is a header root
            // then this is a nested object within a header record. All
            // subsequent object will be nested until another header
            // root is encountered
            //
            // The first header record is considered a root record
            if (headerState != HeaderStateEnum.None)
            {
                if (objectPr.PRparseTypeEnum == InternalParseTypeE.Headers)
                {
                    if (pr.PRisHeaderRoot || (headerState == HeaderStateEnum.FirstHeaderRecord))
                    {
                        headerState = HeaderStateEnum.HeaderRecord;
                    }
                    else
                    {
                        headerState = HeaderStateEnum.TopLevelObject;
                        currentState = InternalParseStateE.Object;
                        pr.PRobjectTypeEnum = InternalObjectTypeE.Object;
                        pr.PRparseTypeEnum = InternalParseTypeE.Object;
                        pr.PRparseStateEnum = InternalParseStateE.Object;
                        pr.PRmemberTypeEnum = InternalMemberTypeE.Empty;
                        pr.PRmemberValueEnum = InternalMemberValueE.Empty;
                    }
                }
                else if (objectPr.PRisHeaderRoot)
                    headerState = HeaderStateEnum.NestedObject;
            }

            InternalST.Soap( this,"ProcessAttributes, headerState ",((Enum)headerState).ToString());


            if (!isTopFound && (objectPr != null ) && (objectPr.PRparseTypeEnum == InternalParseTypeE.Body))
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
                isTopFound = true;
            }
            else if (pr.PRobjectPositionEnum != InternalObjectPositionE.Top)
                pr.PRobjectPositionEnum = InternalObjectPositionE.Child;


            // Don't process type for envelop, topSoapElement unless it has a key of soapEnvKey (SOAP-ENV). Fault
            // is the only top record which currently falls into this category.
            if (!((pr.PRparseTypeEnum == InternalParseTypeE.Envelope)||
                  (pr.PRparseTypeEnum == InternalParseTypeE.Body) ||
                  (pr.PRparseTypeEnum == InternalParseTypeE.Headers) ||
                  (pr.PRobjectPositionEnum == InternalObjectPositionE.Top &&
                   objectReader.IsFakeTopObject &&
                   !pr.PRnameXmlKey.Equals(soapEnvKey))))
            {
                InternalST.Soap( this, "ProcessAttributes  before Process Type ",((Enum)pr.PRparseTypeEnum).ToString());
                ProcessType(pr, objectPr);
            }

            if (keyPosition != null)
            {
                int outRank;
                String outDimSignature;
                InternalArrayTypeE outArrayTypeEnum;
                pr.PRpositionA = ParseArrayDimensions(keyPosition, out outRank, out outDimSignature, out outArrayTypeEnum);
            }

            if (keyOffset != null)
            {
                int outRank;
                String outDimSignature;
                InternalArrayTypeE outArrayTypeEnum;
                pr.PRlowerBoundA = ParseArrayDimensions(keyOffset, out outRank, out outDimSignature, out outArrayTypeEnum);
            }

            if (keyMustUnderstand != null)
                if (keyMustUnderstand.Equals("1"))
                    pr.PRisMustUnderstand = true;
                else if (keyMustUnderstand.Equals("0"))
                    pr.PRisMustUnderstand = false;
                else
                    throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_MustUnderstand"),keyMustUnderstand));

            if (pr.PRparseTypeEnum == InternalParseTypeE.Member)
            {
                //  Process Member			

                InternalST.Soap( this, "ProcessAttributes  Member ");
                stack.Dump();

                if (objectPr.PRparseTypeEnum == InternalParseTypeE.Headers)
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Header;
                else if (objectPr.PRobjectTypeEnum == InternalObjectTypeE.Array)
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                else
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            }
        }
Ejemplo n.º 2
0
        // Called at the begining of an element
        internal void StartElement(String prefix, String name, String urn)
        {
            InternalST.Soap( this,SerTraceString("StartElement Begin ", (ParseRecord)stack.Peek(), name, prefix, urn, currentState, headerState));
            //InternalST.Soap( this,"prefix ",prefix,", Name ",name,", urn ",urn);

            String actualName = NameFilter(name);
            String actualPrefix = prefix;

            ParseRecord pr = null;

            if (!((urn == null) || (urn.Length == 0)) && ((prefix == null) || (prefix.Length == 0)))
            {
                // Need to assign a prefix to the urn
                if (nameSpaceToKey.ContainsKey(urn))
                    actualPrefix = (String)nameSpaceToKey[urn];
                else
                {
                    actualPrefix = NextPrefix();
                    nameSpaceToKey[urn] = actualPrefix;
                }
                InternalST.Soap( this,"StartElement Begin null urn assigned prefix ", actualPrefix);
            }


            switch (currentState)
            {
                case InternalParseStateE.Object:
                    pr = GetPr();
                    pr.PRname = actualName;
                    pr.PRnameXmlKey = actualPrefix;
                    pr.PRxmlNameSpace = urn;
                    pr.PRparseStateEnum = InternalParseStateE.Object;

                    if ((String.Compare(name, "Array", true , CultureInfo.InvariantCulture) == 0) && actualPrefix.Equals(soapKey))
                        pr.PRparseTypeEnum = InternalParseTypeE.Object;
                    else if (((String.Compare(name, "anyType", true, CultureInfo.InvariantCulture) == 0) || (String.Compare(name, "ur-type", true , CultureInfo.InvariantCulture) == 0)) && actualPrefix.Equals(xsdKey))
                    {
                        pr.PRname = "System.Object";
                        pr.PRnameXmlKey = urtKey;
                        pr.PRxmlNameSpace = urn;                        
                        pr.PRparseTypeEnum = InternalParseTypeE.Object;
                    }
                    else if (String.Compare(urn, "http://schemas.xmlsoap.org/soap/envelope/", true, CultureInfo.InvariantCulture) == 0)
                    {
                        if (String.Compare(name, "Envelope", true, CultureInfo.InvariantCulture) == 0)
                        {
                            if (isEnvelope)
                                throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_Parser_Envelope"),prefix+":"+name));

                            isEnvelope = true;
                            pr.PRparseTypeEnum = InternalParseTypeE.Envelope;
                        }
                        else if (String.Compare(name, "Body", true, CultureInfo.InvariantCulture) == 0)
                        {
                            if (!isEnvelope)
                                throw new SerializationException(SoapUtil.GetResourceString("Serialization_Parser_BodyChild"));

                            if (isBody)
                                throw new SerializationException(SoapUtil.GetResourceString("Serialization_Parser_BodyOnce"));

                            isBody = true;
                            headerState = HeaderStateEnum.None;
                            isTopFound = false;
                            pr.PRparseTypeEnum = InternalParseTypeE.Body;                           
                        }
                        else if (String.Compare(name, "Header", true, CultureInfo.InvariantCulture) == 0)
                        {
                            if (!isEnvelope)
                                throw new SerializationException(SoapUtil.GetResourceString("Serialization_Parser_Header"));

                            pr.PRparseTypeEnum = InternalParseTypeE.Headers;
                            headerState = HeaderStateEnum.FirstHeaderRecord;
                        }
                        else
                            pr.PRparseTypeEnum = InternalParseTypeE.Object; //SoapFault has an envelope key					
                    }
                    else
                    {
                        pr.PRparseTypeEnum = InternalParseTypeE.Object;
                    }

                    stack.Push(pr);
                    break;

                case InternalParseStateE.Member:
                    pr = GetPr();

                    // Members of Top object records cannot be reused because of the need to resolving fake element
                    ParseRecord objectPr = (ParseRecord)stack.Peek();
                    pr.PRname = actualName;
                    pr.PRnameXmlKey = actualPrefix;
                    pr.PRxmlNameSpace = urn;                    
                    pr.PRparseTypeEnum = InternalParseTypeE.Member;
                    pr.PRparseStateEnum = InternalParseStateE.Member;
                    stack.Push(pr);
                    break;

                case InternalParseStateE.MemberChild:
                    objectPr = (ParseRecord)stack.PeekPeek();                   
                    pr = (ParseRecord)stack.Peek();
                    pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                    ProcessAttributes(pr, objectPr);
                    switch (headerState)
                    {
                        case HeaderStateEnum.None:
                        case HeaderStateEnum.TopLevelObject:
                            InternalST.Soap( this,"ObjectReader.Parse 1");
                            objectReader.Parse(pr);
                            pr.PRisParsed = true;
                            break;
                        case HeaderStateEnum.HeaderRecord:
                        case HeaderStateEnum.NestedObject:                          
                            ProcessHeaderMember(pr);
                            break;
                    }

                    ParseRecord nestPr = GetPr();
                    nestPr.PRparseTypeEnum = InternalParseTypeE.Member;
                    nestPr.PRparseStateEnum = InternalParseStateE.Member;
                    nestPr.PRname = actualName;
                    nestPr.PRnameXmlKey = actualPrefix;
                    pr.PRxmlNameSpace = urn;                    
                    currentState = InternalParseStateE.Member;
                    stack.Push(nestPr);
                    break;

                default:
                    MarshalError("StartElement", (ParseRecord)stack.Peek(), actualName, currentState);
                    break;
            }

            InternalST.Soap( this,SerTraceString("StartElement End ", (ParseRecord)stack.Peek(), name, currentState, headerState));
        }
Ejemplo n.º 3
0
        // Called at the end of an element
        internal void  EndElement(String prefix, String name, String urn)
        {
            InternalST.Soap( this,SerTraceString("EndElement Begin ", (ParseRecord)stack.Peek(), name, prefix, urn, currentState, headerState));
            //InternalST.Soap( this,"prefix ",prefix,", Name ",name,", urn ",urn);

            String actualName = NameFilter(name);

            ParseRecord objectPr = null;
            ParseRecord pr = null;

            switch (currentState)
            {
                case InternalParseStateE.Object:
                    pr = (ParseRecord)stack.Pop();
                    if (pr.PRparseTypeEnum == InternalParseTypeE.Envelope)
                        pr.PRparseTypeEnum = InternalParseTypeE.EnvelopeEnd;
                    else if (pr.PRparseTypeEnum == InternalParseTypeE.Body)
                        pr.PRparseTypeEnum = InternalParseTypeE.BodyEnd;
                    else if (pr.PRparseTypeEnum == InternalParseTypeE.Headers)
                    {
                        pr.PRparseTypeEnum = InternalParseTypeE.HeadersEnd;
                        headerState = HeaderStateEnum.HeaderRecord;
                    }
                    else if (pr.PRarrayTypeEnum != InternalArrayTypeE.Base64)
                    {
                        // A Base64 array object treated special by ObjectReader. It is completely processed when
                        // pr.PRparseTypeEnum == InternalParseTypeE.Object, an ObjectEnd is not needed to complete parsing

                        // For an element like <element />, the check was not made for top
                        objectPr = (ParseRecord)stack.Peek();
                        InternalST.Soap( this,"SoapParser.EndElement TopFound "+isTopFound+" objectPr.parseTypeEnum "+(objectPr == null?"null":((Enum)objectPr.PRparseTypeEnum).ToString()));
                        if (!isTopFound && (objectPr != null ) && (objectPr.PRparseTypeEnum == InternalParseTypeE.Body))
                        {
                            pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
                            isTopFound = true;
                            InternalST.Soap( this,"SoapParser.EndElement change position to top");
                        }

                        if (!pr.PRisParsed)
                        {
                            InternalST.Soap( this,"SoapParser.EndElement Object hasn't been parsed");
                            if (!pr.PRisProcessAttributes && !(pr.PRobjectPositionEnum == InternalObjectPositionE.Top && objectReader.IsFakeTopObject))
                                ProcessAttributes(pr, objectPr);
                            objectReader.Parse(pr);
                            pr.PRisParsed = true;                           
                        }
                        pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;                                              
                    }

                    switch (headerState)
                    {
                        case HeaderStateEnum.None:
                        case HeaderStateEnum.TopLevelObject:
                            InternalST.Soap( this,"SoapParser.EndElement Parse EndObject");                 
                            objectReader.Parse(pr);
                            break;
                        case HeaderStateEnum.HeaderRecord:
                        case HeaderStateEnum.NestedObject:
                            InternalST.Soap( this,"SoapParser.EndElement ProcessHeaderEnd");                                                                            
                            ProcessHeaderEnd(pr);
                            break;
                    }

                    if (pr.PRparseTypeEnum == InternalParseTypeE.EnvelopeEnd)
                    {
                        // End of document
                        soapParser.Stop();
                    }

                    PutPr(pr);
                    break;

                case InternalParseStateE.Member:
                    pr = (ParseRecord)stack.Peek();
                    objectPr = (ParseRecord)stack.PeekPeek();
                    ProcessAttributes(pr, objectPr);

                    // Check if there are any XmlAttribute records, if there are, process them
                    if (xmlAttributeList != null)
                        InternalST.Soap( this,"XmlAttribute check count ", xmlAttributeList.Count);
                    else
                        InternalST.Soap( this,"XmlAttribute null");

                    if ((xmlAttributeList != null) && (xmlAttributeList.Count > 0))
                    {
                        InternalST.Soap( this,"xmlAttribute list count ", xmlAttributeList.Count);
                        for (int i=0; i<xmlAttributeList.Count; i++)
                        {
                            InternalST.Soap( this,"ObjectReader.Parse 7");                                  
                            objectReader.Parse((ParseRecord)xmlAttributeList[i]);
                        }
                        xmlAttributeList.Clear();
                    }

                    pr = (ParseRecord)stack.Pop();
                    if ((headerState == HeaderStateEnum.TopLevelObject) && (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64))
                    {
                        // A Base64 array object treated specially by ObjectReader. It is completely processed when
                        // pr.PRparseTypeEnum == InternalParseTypeE.Object, an ObjectEnd is not needed to complete parsing
                        InternalST.Soap( this,"ObjectReader.Parse 3");                      
                        objectReader.Parse(pr);
                        pr.PRisParsed = true;                       
                    }
                    else if (pr.PRmemberValueEnum != InternalMemberValueE.Nested)
                    {
                        if ((pr.PRobjectTypeEnum == InternalObjectTypeE.Array) && (pr.PRmemberValueEnum != InternalMemberValueE.Null))
                        {
                            // Empty array
                            pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                            InternalST.Soap( this,"ObjectReader.Parse 4");                          
                            objectReader.Parse(pr);
                            pr.PRisParsed = true;                           

                            pr.PRparseTypeEnum = InternalParseTypeE.MemberEnd;
                        }
                        else if (pr.PRidRef > 0)
                            pr.PRmemberValueEnum = InternalMemberValueE.Reference;
                        else if (pr.PRmemberValueEnum != InternalMemberValueE.Null)
                            pr.PRmemberValueEnum = InternalMemberValueE.InlineValue;

                        switch (headerState)
                        {
                            case HeaderStateEnum.None:
                            case HeaderStateEnum.TopLevelObject:
                                InternalST.Soap( this,"ObjectReader.Parse 5"); 
                                if (pr.PRparseTypeEnum == InternalParseTypeE.Object)
                                {
                                    // Empty object in header case
                                    if (!pr.PRisParsed)
                                        objectReader.Parse(pr);
                                    pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                                }
                                objectReader.Parse(pr);
                                pr.PRisParsed = true;                               
                                break;
                            case HeaderStateEnum.HeaderRecord:
                            case HeaderStateEnum.NestedObject:                              
                                ProcessHeaderMember(pr);
                                break;
                        }
                    }
                    else
                    {
                        // Nested member already parsed, need end to finish nested object
                        pr.PRparseTypeEnum = InternalParseTypeE.MemberEnd;
                        switch (headerState)
                        {
                            case HeaderStateEnum.None:
                            case HeaderStateEnum.TopLevelObject:
                                InternalST.Soap( this,"ObjectReader.Parse 6");                              
                                objectReader.Parse(pr);
                                pr.PRisParsed = true;                               
                                break;
                            case HeaderStateEnum.HeaderRecord:
                            case HeaderStateEnum.NestedObject:                              
                                ProcessHeaderMemberEnd(pr);
                                break;
                        }
                    }
                    PutPr(pr);
                    break;

                case InternalParseStateE.MemberChild:
                    pr = (ParseRecord)stack.Peek();
                    if (pr.PRmemberValueEnum != InternalMemberValueE.Null)
                        MarshalError("EndElement", (ParseRecord)stack.Peek(), actualName, currentState);
                    break;

                default:
                    MarshalError("EndElement", (ParseRecord)stack.Peek(), actualName, currentState);
                    break;
            }
            InternalST.Soap( this,SerTraceString("EndElement End ", (ParseRecord)stack.Peek(), name, currentState, headerState));
        }
Ejemplo n.º 4
0
        private static String SerTraceString(String handler, ParseRecord pr, String value, String prefix, String urn, InternalParseStateE currentState, HeaderStateEnum headerState)
        {
            String valueString = "";
            if (value != null)
                valueString = value;

            String prString = "";
            if (pr != null)
                prString = ((Enum)pr.PRparseStateEnum).ToString();

            return handler+" - name "+valueString+", prefix "+prefix+", urn "+urn+", CuurentState "+((Enum)currentState).ToString()+", HeaderState "+((Enum)headerState).ToString()+", PushState "+prString;        
        }
        internal void EndElement(string prefix, string name, string urn)
        {
            string str = this.NameFilter(name);
            ParseRecord objectPr = null;
            ParseRecord pr = null;
            switch (this.currentState)
            {
                case InternalParseStateE.Object:
                    pr = (ParseRecord) this.stack.Pop();
                    if (pr.PRparseTypeEnum != InternalParseTypeE.Envelope)
                    {
                        if (pr.PRparseTypeEnum == InternalParseTypeE.Body)
                        {
                            pr.PRparseTypeEnum = InternalParseTypeE.BodyEnd;
                        }
                        else if (pr.PRparseTypeEnum == InternalParseTypeE.Headers)
                        {
                            pr.PRparseTypeEnum = InternalParseTypeE.HeadersEnd;
                            this.headerState = HeaderStateEnum.HeaderRecord;
                        }
                        else if (pr.PRarrayTypeEnum != InternalArrayTypeE.Base64)
                        {
                            objectPr = (ParseRecord) this.stack.Peek();
                            if ((!this.isTopFound && (objectPr != null)) && (objectPr.PRparseTypeEnum == InternalParseTypeE.Body))
                            {
                                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
                                this.isTopFound = true;
                            }
                            if (!pr.PRisParsed)
                            {
                                if (!pr.PRisProcessAttributes && ((pr.PRobjectPositionEnum != InternalObjectPositionE.Top) || !this.objectReader.IsFakeTopObject))
                                {
                                    this.ProcessAttributes(pr, objectPr);
                                }
                                this.objectReader.Parse(pr);
                                pr.PRisParsed = true;
                            }
                            pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                        }
                        break;
                    }
                    pr.PRparseTypeEnum = InternalParseTypeE.EnvelopeEnd;
                    break;

                case InternalParseStateE.Member:
                {
                    pr = (ParseRecord) this.stack.Peek();
                    objectPr = (ParseRecord) this.stack.PeekPeek();
                    this.ProcessAttributes(pr, objectPr);
                    ArrayList xmlAttributeList = this.xmlAttributeList;
                    if ((this.xmlAttributeList != null) && (this.xmlAttributeList.Count > 0))
                    {
                        for (int i = 0; i < this.xmlAttributeList.Count; i++)
                        {
                            this.objectReader.Parse((ParseRecord) this.xmlAttributeList[i]);
                        }
                        this.xmlAttributeList.Clear();
                    }
                    pr = (ParseRecord) this.stack.Pop();
                    if ((this.headerState == HeaderStateEnum.TopLevelObject) && (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64))
                    {
                        this.objectReader.Parse(pr);
                        pr.PRisParsed = true;
                    }
                    else if (pr.PRmemberValueEnum != InternalMemberValueE.Nested)
                    {
                        if ((pr.PRobjectTypeEnum == InternalObjectTypeE.Array) && (pr.PRmemberValueEnum != InternalMemberValueE.Null))
                        {
                            pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                            this.objectReader.Parse(pr);
                            pr.PRisParsed = true;
                            pr.PRparseTypeEnum = InternalParseTypeE.MemberEnd;
                        }
                        else if (pr.PRidRef > 0L)
                        {
                            pr.PRmemberValueEnum = InternalMemberValueE.Reference;
                        }
                        else if (pr.PRmemberValueEnum != InternalMemberValueE.Null)
                        {
                            pr.PRmemberValueEnum = InternalMemberValueE.InlineValue;
                        }
                        switch (this.headerState)
                        {
                            case HeaderStateEnum.None:
                            case HeaderStateEnum.TopLevelObject:
                                if (pr.PRparseTypeEnum == InternalParseTypeE.Object)
                                {
                                    if (!pr.PRisParsed)
                                    {
                                        this.objectReader.Parse(pr);
                                    }
                                    pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                                }
                                this.objectReader.Parse(pr);
                                pr.PRisParsed = true;
                                break;

                            case HeaderStateEnum.HeaderRecord:
                            case HeaderStateEnum.NestedObject:
                                this.ProcessHeaderMember(pr);
                                break;
                        }
                    }
                    else
                    {
                        pr.PRparseTypeEnum = InternalParseTypeE.MemberEnd;
                        switch (this.headerState)
                        {
                            case HeaderStateEnum.None:
                            case HeaderStateEnum.TopLevelObject:
                                this.objectReader.Parse(pr);
                                pr.PRisParsed = true;
                                break;

                            case HeaderStateEnum.HeaderRecord:
                            case HeaderStateEnum.NestedObject:
                                this.ProcessHeaderMemberEnd(pr);
                                break;
                        }
                    }
                    this.PutPr(pr);
                    return;
                }
                case InternalParseStateE.MemberChild:
                    pr = (ParseRecord) this.stack.Peek();
                    if (pr.PRmemberValueEnum != InternalMemberValueE.Null)
                    {
                        this.MarshalError("EndElement", (ParseRecord) this.stack.Peek(), str, this.currentState);
                    }
                    return;

                default:
                    this.MarshalError("EndElement", (ParseRecord) this.stack.Peek(), str, this.currentState);
                    return;
            }
            switch (this.headerState)
            {
                case HeaderStateEnum.None:
                case HeaderStateEnum.TopLevelObject:
                    this.objectReader.Parse(pr);
                    break;

                case HeaderStateEnum.HeaderRecord:
                case HeaderStateEnum.NestedObject:
                    this.ProcessHeaderEnd(pr);
                    break;
            }
            if (pr.PRparseTypeEnum == InternalParseTypeE.EnvelopeEnd)
            {
                this.soapParser.Stop();
            }
            this.PutPr(pr);
        }
 private void ProcessAttributes(ParseRecord pr, ParseRecord objectPr)
 {
     string dimString = null;
     string str2 = null;
     string str3 = null;
     pr.PRisProcessAttributes = true;
     string strB = "http://schemas.xmlsoap.org/soap/encoding/";
     int length = strB.Length;
     string str5 = "http://schemas.microsoft.com/clr/id";
     int num2 = str5.Length;
     string str6 = "http://schemas.xmlsoap.org/soap/envelope/";
     int num3 = str6.Length;
     string str7 = "http://www.w3.org/2001/XMLSchema-instance";
     int num4 = str7.Length;
     string str8 = "http://www.w3.org/2000/10/XMLSchema-instance";
     int num5 = str8.Length;
     string str9 = "http://www.w3.org/1999/XMLSchema-instance";
     int num6 = str9.Length;
     string str10 = "http://www.w3.org/1999/XMLSchema";
     int num7 = str10.Length;
     string str11 = "http://www.w3.org/2000/10/XMLSchema";
     int num8 = str11.Length;
     string str12 = "http://www.w3.org/2001/XMLSchema";
     int num9 = str12.Length;
     string str13 = "http://schemas.microsoft.com/soap/encoding/clr/1.0";
     int num10 = str13.Length;
     for (int i = 0; i < this.attributeValues.Count(); i++)
     {
         AttributeValueEntry item = (AttributeValueEntry) this.attributeValues.GetItem(i);
         string prefix = item.prefix;
         string key = item.key;
         if ((key == null) || (key.Length == 0))
         {
             key = pr.PRnameXmlKey;
         }
         string keyId = item.value;
         bool flag = false;
         string urn = item.urn;
         int num12 = key.Length;
         int num13 = keyId.Length;
         if ((key == null) || (num12 == 0))
         {
             this.keyToNamespaceTable[prefix] = keyId;
         }
         else
         {
             this.keyToNamespaceTable[prefix + ":" + key] = keyId;
         }
         if ((num12 == 2) && (string.Compare(key, "id", StringComparison.OrdinalIgnoreCase) == 0))
         {
             pr.PRobjectId = this.objectReader.GetId(keyId);
         }
         else if ((num12 == 8) && (string.Compare(key, "position", StringComparison.OrdinalIgnoreCase) == 0))
         {
             dimString = keyId;
         }
         else if ((num12 == 6) && (string.Compare(key, "offset", StringComparison.OrdinalIgnoreCase) == 0))
         {
             str2 = keyId;
         }
         else if ((num12 == 14) && (string.Compare(key, "MustUnderstand", StringComparison.OrdinalIgnoreCase) == 0))
         {
             str3 = keyId;
         }
         else if ((num12 == 4) && (string.Compare(key, "null", StringComparison.OrdinalIgnoreCase) == 0))
         {
             pr.PRmemberValueEnum = InternalMemberValueE.Null;
             pr.PRvalue = null;
         }
         else if ((num12 == 4) && (string.Compare(key, "root", StringComparison.OrdinalIgnoreCase) == 0))
         {
             if (keyId.Equals("1"))
             {
                 pr.PRisHeaderRoot = true;
             }
         }
         else if ((num12 == 4) && (string.Compare(key, "href", StringComparison.OrdinalIgnoreCase) == 0))
         {
             pr.PRidRef = this.objectReader.GetId(keyId);
         }
         else if ((num12 == 4) && (string.Compare(key, "type", StringComparison.OrdinalIgnoreCase) == 0))
         {
             string pRtypeXmlKey = pr.PRtypeXmlKey;
             string pRkeyDt = pr.PRkeyDt;
             Type pRdtType = pr.PRdtType;
             string strA = keyId;
             int index = keyId.IndexOf(":");
             if (index > 0)
             {
                 pr.PRtypeXmlKey = keyId.Substring(0, index);
                 strA = keyId.Substring(++index);
             }
             else
             {
                 pr.PRtypeXmlKey = prefix;
             }
             if ((string.Compare(strA, "anyType", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(strA, "ur-type", StringComparison.OrdinalIgnoreCase) == 0))
             {
                 pr.PRkeyDt = "System.Object";
                 pr.PRdtType = SoapUtil.typeofObject;
                 pr.PRtypeXmlKey = this.urtKey;
             }
             if ((pr.PRtypeXmlKey == this.soapKey) && (strA == "Array"))
             {
                 pr.PRtypeXmlKey = pRtypeXmlKey;
                 pr.PRkeyDt = pRkeyDt;
                 pr.PRdtType = pRdtType;
             }
             else
             {
                 pr.PRkeyDt = strA;
             }
         }
         else if ((num12 == 9) && (string.Compare(key, "arraytype", StringComparison.OrdinalIgnoreCase) == 0))
         {
             string str21 = keyId;
             int num15 = keyId.IndexOf(":");
             if (num15 > 0)
             {
                 pr.PRtypeXmlKey = keyId.Substring(0, num15);
                 pr.PRkeyDt = str21 = keyId.Substring(++num15);
             }
             if (str21.StartsWith("ur_type[", StringComparison.Ordinal))
             {
                 pr.PRkeyDt = "System.Object" + str21.Substring(6);
                 pr.PRtypeXmlKey = this.urtKey;
             }
         }
         else if (SoapServices.IsClrTypeNamespace(keyId))
         {
             if (!this.assemKeyToAssemblyTable.ContainsKey(key))
             {
                 string typeNamespace = null;
                 string assemblyName = null;
                 SoapServices.DecodeXmlNamespaceForClrTypeNamespace(keyId, out typeNamespace, out assemblyName);
                 if (assemblyName == null)
                 {
                     this.assemKeyToAssemblyTable[key] = new SoapAssemblyInfo(SoapUtil.urtAssemblyString, SoapUtil.urtAssembly);
                     this.assemKeyToNameSpaceTable[key] = typeNamespace;
                 }
                 else
                 {
                     this.assemKeyToAssemblyTable[key] = new SoapAssemblyInfo(assemblyName);
                     if (typeNamespace != null)
                     {
                         this.assemKeyToNameSpaceTable[key] = typeNamespace;
                     }
                 }
             }
         }
         else if (((flag = prefix.Equals("xmlns")) && (num13 == length)) && (string.Compare(keyId, strB, StringComparison.OrdinalIgnoreCase) == 0))
         {
             this.soapKey = key;
         }
         else if ((flag && (num13 == num2)) && (string.Compare(keyId, str5, StringComparison.OrdinalIgnoreCase) == 0))
         {
             this.urtKey = key;
             this.assemKeyToAssemblyTable[this.urtKey] = new SoapAssemblyInfo(SoapUtil.urtAssemblyString, SoapUtil.urtAssembly);
         }
         else if ((flag && (num13 == num3)) && (string.Compare(keyId, str6, StringComparison.OrdinalIgnoreCase) == 0))
         {
             this.soapEnvKey = key;
         }
         else if (key != "encodingStyle")
         {
             if (flag && ((((num13 == num4) && (string.Compare(keyId, str7, StringComparison.OrdinalIgnoreCase) == 0)) || ((num13 == num6) && (string.Compare(keyId, str9, StringComparison.OrdinalIgnoreCase) == 0))) || ((num13 == num5) && (string.Compare(keyId, str8, StringComparison.OrdinalIgnoreCase) == 0))))
             {
                 this.xsiKey = key;
             }
             else if ((((flag && (num13 == num9)) && (string.Compare(keyId, str12, StringComparison.OrdinalIgnoreCase) == 0)) || ((num13 == num7) && (string.Compare(keyId, str10, StringComparison.OrdinalIgnoreCase) == 0))) || ((num13 == num8) && (string.Compare(keyId, str11, StringComparison.OrdinalIgnoreCase) == 0)))
             {
                 this.xsdKey = key;
             }
             else if ((flag && (num13 == num10)) && (string.Compare(keyId, str13, StringComparison.OrdinalIgnoreCase) == 0))
             {
                 this.objectReader.SetVersion(1, 0);
             }
             else if (flag)
             {
                 this.assemKeyToInteropAssemblyTable[key] = keyId;
             }
             else if (((string.Compare(prefix, this.soapKey, StringComparison.OrdinalIgnoreCase) != 0) && this.assemKeyToInteropAssemblyTable.ContainsKey(prefix)) && ((string) this.assemKeyToInteropAssemblyTable[prefix]).Equals(urn))
             {
                 this.ProcessXmlAttribute(prefix, key, keyId, objectPr);
             }
         }
     }
     this.attributeValues.Clear();
     if (this.headerState != HeaderStateEnum.None)
     {
         if (objectPr.PRparseTypeEnum == InternalParseTypeE.Headers)
         {
             if (pr.PRisHeaderRoot || (this.headerState == HeaderStateEnum.FirstHeaderRecord))
             {
                 this.headerState = HeaderStateEnum.HeaderRecord;
             }
             else
             {
                 this.headerState = HeaderStateEnum.TopLevelObject;
                 this.currentState = InternalParseStateE.Object;
                 pr.PRobjectTypeEnum = InternalObjectTypeE.Object;
                 pr.PRparseTypeEnum = InternalParseTypeE.Object;
                 pr.PRparseStateEnum = InternalParseStateE.Object;
                 pr.PRmemberTypeEnum = InternalMemberTypeE.Empty;
                 pr.PRmemberValueEnum = InternalMemberValueE.Empty;
             }
         }
         else if (objectPr.PRisHeaderRoot)
         {
             this.headerState = HeaderStateEnum.NestedObject;
         }
     }
     if ((!this.isTopFound && (objectPr != null)) && (objectPr.PRparseTypeEnum == InternalParseTypeE.Body))
     {
         pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
         this.isTopFound = true;
     }
     else if (pr.PRobjectPositionEnum != InternalObjectPositionE.Top)
     {
         pr.PRobjectPositionEnum = InternalObjectPositionE.Child;
     }
     if ((((pr.PRparseTypeEnum != InternalParseTypeE.Envelope) && (pr.PRparseTypeEnum != InternalParseTypeE.Body)) && (pr.PRparseTypeEnum != InternalParseTypeE.Headers)) && (((pr.PRobjectPositionEnum != InternalObjectPositionE.Top) || !this.objectReader.IsFakeTopObject) || pr.PRnameXmlKey.Equals(this.soapEnvKey)))
     {
         this.ProcessType(pr, objectPr);
     }
     if (dimString != null)
     {
         int num16;
         string str24;
         InternalArrayTypeE ee;
         pr.PRpositionA = this.ParseArrayDimensions(dimString, out num16, out str24, out ee);
     }
     if (str2 != null)
     {
         int num17;
         string str25;
         InternalArrayTypeE ee2;
         pr.PRlowerBoundA = this.ParseArrayDimensions(str2, out num17, out str25, out ee2);
     }
     if (str3 != null)
     {
         if (!str3.Equals("1"))
         {
             if (!str3.Equals("0"))
             {
                 throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_MustUnderstand"), new object[] { str3 }));
             }
             pr.PRisMustUnderstand = false;
         }
         else
         {
             pr.PRisMustUnderstand = true;
         }
     }
     if (pr.PRparseTypeEnum == InternalParseTypeE.Member)
     {
         if (objectPr.PRparseTypeEnum == InternalParseTypeE.Headers)
         {
             pr.PRmemberTypeEnum = InternalMemberTypeE.Header;
         }
         else if (objectPr.PRobjectTypeEnum == InternalObjectTypeE.Array)
         {
             pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
         }
         else
         {
             pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
         }
     }
 }
        internal void StartElement(string prefix, string name, string urn)
        {
            ParseRecord record2;
            string str = this.NameFilter(name);
            string str2 = prefix;
            ParseRecord pr = null;
            if (((urn != null) && (urn.Length != 0)) && ((prefix == null) || (prefix.Length == 0)))
            {
                if (this.nameSpaceToKey.ContainsKey(urn))
                {
                    str2 = (string) this.nameSpaceToKey[urn];
                }
                else
                {
                    str2 = this.NextPrefix();
                    this.nameSpaceToKey[urn] = str2;
                }
            }
            switch (this.currentState)
            {
                case InternalParseStateE.Object:
                    pr = this.GetPr();
                    pr.PRname = str;
                    pr.PRnameXmlKey = str2;
                    pr.PRxmlNameSpace = urn;
                    pr.PRparseStateEnum = InternalParseStateE.Object;
                    if ((string.Compare(name, "Array", StringComparison.OrdinalIgnoreCase) != 0) || !str2.Equals(this.soapKey))
                    {
                        if (((string.Compare(name, "anyType", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(name, "ur-type", StringComparison.OrdinalIgnoreCase) == 0)) && str2.Equals(this.xsdKey))
                        {
                            pr.PRname = "System.Object";
                            pr.PRnameXmlKey = this.urtKey;
                            pr.PRxmlNameSpace = urn;
                            pr.PRparseTypeEnum = InternalParseTypeE.Object;
                        }
                        else if (string.Compare(urn, "http://schemas.xmlsoap.org/soap/envelope/", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            if (string.Compare(name, "Envelope", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                if (this.isEnvelope)
                                {
                                    throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Parser_Envelope"), new object[] { prefix + ":" + name }));
                                }
                                this.isEnvelope = true;
                                pr.PRparseTypeEnum = InternalParseTypeE.Envelope;
                            }
                            else if (string.Compare(name, "Body", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                if (!this.isEnvelope)
                                {
                                    throw new SerializationException(SoapUtil.GetResourceString("Serialization_Parser_BodyChild"));
                                }
                                if (this.isBody)
                                {
                                    throw new SerializationException(SoapUtil.GetResourceString("Serialization_Parser_BodyOnce"));
                                }
                                this.isBody = true;
                                this.headerState = HeaderStateEnum.None;
                                this.isTopFound = false;
                                pr.PRparseTypeEnum = InternalParseTypeE.Body;
                            }
                            else if (string.Compare(name, "Header", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                if (!this.isEnvelope)
                                {
                                    throw new SerializationException(SoapUtil.GetResourceString("Serialization_Parser_Header"));
                                }
                                pr.PRparseTypeEnum = InternalParseTypeE.Headers;
                                this.headerState = HeaderStateEnum.FirstHeaderRecord;
                            }
                            else
                            {
                                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                            }
                        }
                        else
                        {
                            pr.PRparseTypeEnum = InternalParseTypeE.Object;
                        }
                        break;
                    }
                    pr.PRparseTypeEnum = InternalParseTypeE.Object;
                    break;

                case InternalParseStateE.Member:
                    pr = this.GetPr();
                    record2 = (ParseRecord) this.stack.Peek();
                    pr.PRname = str;
                    pr.PRnameXmlKey = str2;
                    pr.PRxmlNameSpace = urn;
                    pr.PRparseTypeEnum = InternalParseTypeE.Member;
                    pr.PRparseStateEnum = InternalParseStateE.Member;
                    this.stack.Push(pr);
                    return;

                case InternalParseStateE.MemberChild:
                {
                    record2 = (ParseRecord) this.stack.PeekPeek();
                    pr = (ParseRecord) this.stack.Peek();
                    pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                    this.ProcessAttributes(pr, record2);
                    switch (this.headerState)
                    {
                        case HeaderStateEnum.None:
                        case HeaderStateEnum.TopLevelObject:
                            this.objectReader.Parse(pr);
                            pr.PRisParsed = true;
                            break;

                        case HeaderStateEnum.HeaderRecord:
                        case HeaderStateEnum.NestedObject:
                            this.ProcessHeaderMember(pr);
                            break;
                    }
                    ParseRecord record3 = this.GetPr();
                    record3.PRparseTypeEnum = InternalParseTypeE.Member;
                    record3.PRparseStateEnum = InternalParseStateE.Member;
                    record3.PRname = str;
                    record3.PRnameXmlKey = str2;
                    pr.PRxmlNameSpace = urn;
                    this.currentState = InternalParseStateE.Member;
                    this.stack.Push(record3);
                    return;
                }
                default:
                    this.MarshalError("StartElement", (ParseRecord) this.stack.Peek(), str, this.currentState);
                    return;
            }
            this.stack.Push(pr);
        }
 private static string SerTraceString(string handler, ParseRecord pr, string value, InternalParseStateE currentState, HeaderStateEnum headerState)
 {
     string str = "";
     if (value != null)
     {
         str = value;
     }
     string str2 = "";
     if (pr != null)
     {
         str2 = pr.PRparseStateEnum.ToString();
     }
     return (handler + " - " + str + ", State " + currentState.ToString() + ", PushState " + str2);
 }