internal void Init()
 {
     this.PRparseTypeEnum      = InternalParseTypeE.Empty;
     this.PRobjectTypeEnum     = InternalObjectTypeE.Empty;
     this.PRarrayTypeEnum      = InternalArrayTypeE.Empty;
     this.PRmemberTypeEnum     = InternalMemberTypeE.Empty;
     this.PRmemberValueEnum    = InternalMemberValueE.Empty;
     this.PRobjectPositionEnum = InternalObjectPositionE.Empty;
     this.PRname                     = null;
     this.PRnameXmlKey               = null;
     this.PRxmlNameSpace             = null;
     this.PRisParsed                 = false;
     this.PRisProcessAttributes      = false;
     this.PRvalue                    = null;
     this.PRkeyDt                    = null;
     this.PRdtType                   = null;
     this.PRassemblyName             = null;
     this.PRdtTypeCode               = InternalPrimitiveTypeE.Invalid;
     this.PRisEnum                   = false;
     this.PRobjectId                 = 0L;
     this.PRidRef                    = 0L;
     this.PRarrayElementTypeString   = null;
     this.PRarrayElementType         = null;
     this.PRisArrayVariant           = false;
     this.PRarrayElementTypeCode     = InternalPrimitiveTypeE.Invalid;
     this.PRprimitiveArrayTypeString = null;
     this.PRrank                     = 0;
     this.PRlengthA                  = null;
     this.PRpositionA                = null;
     this.PRlowerBoundA              = null;
     this.PRupperBoundA              = null;
     this.PRindexMap                 = null;
     this.PRmemberIndex              = 0;
     this.PRlinearlength             = 0;
     this.PRrectangularMap           = null;
     this.PRisLowerBound             = false;
     this.PRtopId                    = 0L;
     this.PRheaderId                 = 0L;
     this.PRisHeaderRoot             = false;
     this.PRisAttributesProcessed    = false;
     this.PRisMustUnderstand         = false;
     this.PRparseStateEnum           = InternalParseStateE.Initial;
     this.PRisWaitingForNestedObject = false;
     this.PRisValueTypeFixup         = false;
     this.PRnewObj                   = null;
     this.PRobjectA                  = null;
     this.PRprimitiveArray           = null;
     this.PRobjectInfo               = null;
     this.PRisRegistered             = false;
     this.PRisXmlAttribute           = false;
 }
Example #2
0
        // Called at the end of process the child nodes for an element
        internal void FinishChildren(String prefix, String name, String urn)
        {
            InternalST.Soap( this,SerTraceString("FinishChildren Begin ", (ParseRecord)stack.Peek(), name, prefix, urn, currentState, headerState));
            //InternalST.Soap( this,"prefix ",prefix,", Name ",name,", urn ",urn);

            ParseRecord pr = null;

            switch (currentState)
            {
                case InternalParseStateE.Member:
                    pr = (ParseRecord)stack.Peek();                             
                    currentState = pr.PRparseStateEnum;
                    // For an object which has a value such as top level System.String
                    pr.PRvalue = textValue;
                    textValue = "";
                    break;

                case InternalParseStateE.MemberChild:
                    pr = (ParseRecord)stack.Peek();                             
                    currentState = pr.PRparseStateEnum;

                    ParseRecord objectPr = (ParseRecord)stack.PeekPeek();
                    pr.PRvalue = textValue; // Non-primitive type need to filter
                    textValue = "";

                    break;

                case InternalParseStateE.Object:
                    pr = (ParseRecord)stack.Peek();
                    if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
                    {
                        pr.PRvalue = textValue;
                        textValue = "";
                    }
                    // Only occur for top object, returning to SerializedStreamHeader object
                    break;

                default:
                    MarshalError("FinishChildren", (ParseRecord)stack.Peek(), name, currentState);
                    break;
            }

            InternalST.Soap( this,SerTraceString("FinishChildren End ", (ParseRecord)stack.Peek(), name, currentState, headerState));
        }
Example #3
0
        // Called at the start of processing child nodes for an element
        internal void StartChildren()
        {
            InternalST.Soap( this,SerTraceString("StartChildren Begin ", (ParseRecord)stack.Peek(), null, currentState, headerState));

            ParseRecord pr = null;

            switch (currentState)
            {
                case InternalParseStateE.Object:
                    InternalST.Soap( this,"StartChildren Object");
                    pr = (ParseRecord)stack.Peek();
                    ParseRecord objectPr = (ParseRecord)stack.PeekPeek();
                    ProcessAttributes(pr, objectPr);
                    if (pr.PRarrayTypeEnum != InternalArrayTypeE.Base64)
                    {
                        if (!((pr.PRparseTypeEnum == InternalParseTypeE.Envelope) || (pr.PRparseTypeEnum == InternalParseTypeE.Body)))
                        {
                            currentState = InternalParseStateE.Member;

                        }

                        switch (headerState)
                        {
                            case HeaderStateEnum.None:
                            case HeaderStateEnum.TopLevelObject:
                                InternalST.Soap( this,"ObjectReader.Parse 8");
                                InternalST.Soap( this,"SoapParser.StartChildren 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.StartChildren change position to top");
                                }
                                objectReader.Parse(pr);
                                pr.PRisParsed = true;                               
                                break;
                            case HeaderStateEnum.HeaderRecord:
                            case HeaderStateEnum.NestedObject:
                            case HeaderStateEnum.FirstHeaderRecord:
                                ProcessHeader(pr);                              
                                break;                          
                        }
                    }
                    break;

                case InternalParseStateE.Member:
                    InternalST.Soap( this,"StartChildren Member");                  
                    pr = (ParseRecord)stack.Peek();             
                    currentState = InternalParseStateE.MemberChild;
                    break;

                case InternalParseStateE.MemberChild:
                default:
                    MarshalError("StartChildren", (ParseRecord)stack.Peek(), null, currentState);
                    break;
            }

            InternalST.Soap( this, "StartChildren 10");     
            InternalST.Soap( this,SerTraceString("StartChildren End ", (ParseRecord)stack.Peek(), null, currentState, headerState));
        }
Example #4
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));
        }
Example #5
0
 // Called at the beginning of parsing
 internal void Start(XmlTextReader p)
 {
     InternalST.Soap( this,"Start ");
     currentState = InternalParseStateE.Object;
     xmlTextReader = p;
 }
Example #6
0
        // Formats the error message and throws a SerializationException
        private void MarshalError(String handler, ParseRecord pr, String value, InternalParseStateE currentState)
        {
            String traceString = SerTraceString(handler, pr, value, currentState, headerState);

            InternalST.Soap( this,"MarshalError,",traceString);

            throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_Syntax"),traceString));                                                    
        }
Example #7
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;        
        }
        // Initialize ParseRecord. Called when reusing.
        internal void Init()
        {
            // Enums
            PRparseTypeEnum      = InternalParseTypeE.Empty;
            PRobjectTypeEnum     = InternalObjectTypeE.Empty;
            PRarrayTypeEnum      = InternalArrayTypeE.Empty;
            PRmemberTypeEnum     = InternalMemberTypeE.Empty;
            PRmemberValueEnum    = InternalMemberValueE.Empty;
            PRobjectPositionEnum = InternalObjectPositionE.Empty;

            // Object
            PRname                = null;
            PRnameXmlKey          = null;
            PRxmlNameSpace        = null;
            PRisParsed            = false;
            PRisProcessAttributes = false;

            // Value
            PRvalue = null;

            // dt attribute
            PRkeyDt        = null;
            PRdtType       = null;
            PRassemblyName = null;
            PRdtTypeCode   = InternalPrimitiveTypeE.Invalid;
            PRisEnum       = false;

            // Object ID
            PRobjectId = 0;

            // Reference ID
            PRidRef = 0;

            // Array

            // Array Element Type
            PRarrayElementTypeString = null;
            PRarrayElementType       = null;
            PRisArrayVariant         = false;
            PRarrayElementTypeCode   = InternalPrimitiveTypeE.Invalid;


            // Array Primitive Element type
            PRprimitiveArrayTypeString = null;

            // Parsed array information
            PRrank        = 0;
            PRlengthA     = null;
            PRpositionA   = null;
            PRlowerBoundA = null;
            PRupperBoundA = null;

            // Array map for placing array elements in array
            PRindexMap       = null;
            PRmemberIndex    = 0;
            PRlinearlength   = 0;
            PRrectangularMap = null;
            PRisLowerBound   = false;

            // SerializedStreamHeader information
            PRtopId                 = 0;
            PRheaderId              = 0;
            PRisHeaderRoot          = false;
            PRisAttributesProcessed = false;

            // Parsed HeaderMember Information
            PRisMustUnderstand = false;

            // Parse State
            PRparseStateEnum           = InternalParseStateE.Initial;
            PRisWaitingForNestedObject = false;


            // ValueType Fixup needed
            PRisValueTypeFixup = false;

            PRnewObj         = null;
            PRobjectA        = null;
            PRprimitiveArray = null;
            PRobjectInfo     = null;
            PRisRegistered   = false;

            PRisXmlAttribute = false;
        }
 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;
         }
     }
 }
 private void MarshalError(string handler, ParseRecord pr, string value, InternalParseStateE currentState)
 {
     string str = SerTraceString(handler, pr, value, currentState, this.headerState);
     throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Syntax"), new object[] { str }));
 }
        internal void FinishChildren(string prefix, string name, string urn)
        {
            ParseRecord record = null;
            switch (this.currentState)
            {
                case InternalParseStateE.Object:
                    record = (ParseRecord) this.stack.Peek();
                    if (record.PRarrayTypeEnum != InternalArrayTypeE.Base64)
                    {
                        break;
                    }
                    record.PRvalue = this.textValue;
                    this.textValue = "";
                    return;

                case InternalParseStateE.Member:
                    record = (ParseRecord) this.stack.Peek();
                    this.currentState = record.PRparseStateEnum;
                    record.PRvalue = this.textValue;
                    this.textValue = "";
                    return;

                case InternalParseStateE.MemberChild:
                {
                    record = (ParseRecord) this.stack.Peek();
                    this.currentState = record.PRparseStateEnum;
                    ParseRecord record1 = (ParseRecord) this.stack.PeekPeek();
                    record.PRvalue = this.textValue;
                    this.textValue = "";
                    return;
                }
                default:
                    this.MarshalError("FinishChildren", (ParseRecord) this.stack.Peek(), name, this.currentState);
                    break;
            }
        }
        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);
        }
        internal void StartChildren()
        {
            ParseRecord pr = null;
            switch (this.currentState)
            {
                case InternalParseStateE.Object:
                {
                    pr = (ParseRecord) this.stack.Peek();
                    ParseRecord objectPr = (ParseRecord) this.stack.PeekPeek();
                    this.ProcessAttributes(pr, objectPr);
                    if (pr.PRarrayTypeEnum != InternalArrayTypeE.Base64)
                    {
                        if ((pr.PRparseTypeEnum != InternalParseTypeE.Envelope) && (pr.PRparseTypeEnum != InternalParseTypeE.Body))
                        {
                            this.currentState = InternalParseStateE.Member;
                        }
                        switch (this.headerState)
                        {
                            case HeaderStateEnum.None:
                            case HeaderStateEnum.TopLevelObject:
                                if ((!this.isTopFound && (objectPr != null)) && (objectPr.PRparseTypeEnum == InternalParseTypeE.Body))
                                {
                                    pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
                                    this.isTopFound = true;
                                }
                                this.objectReader.Parse(pr);
                                pr.PRisParsed = true;
                                return;

                            case HeaderStateEnum.FirstHeaderRecord:
                            case HeaderStateEnum.HeaderRecord:
                            case HeaderStateEnum.NestedObject:
                                this.ProcessHeader(pr);
                                return;
                        }
                    }
                    return;
                }
                case InternalParseStateE.Member:
                    pr = (ParseRecord) this.stack.Peek();
                    this.currentState = InternalParseStateE.MemberChild;
                    return;
            }
            this.MarshalError("StartChildren", (ParseRecord) this.stack.Peek(), null, this.currentState);
        }
 internal void Start(XmlTextReader p)
 {
     this.currentState = InternalParseStateE.Object;
     this.xmlTextReader = p;
 }
 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);
 }
Example #16
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;
            }
        }
Example #17
0
		// Initialize ParseRecord. Called when reusing.
		internal void Init()
		{
			// Enums
			PRparseTypeEnum = InternalParseTypeE.Empty;
			PRobjectTypeEnum = InternalObjectTypeE.Empty;
			PRarrayTypeEnum = InternalArrayTypeE.Empty;
			PRmemberTypeEnum = InternalMemberTypeE.Empty;
			PRmemberValueEnum = InternalMemberValueE.Empty;
			PRobjectPositionEnum = InternalObjectPositionE.Empty;

			// Object
			PRname = null;
			PRnameXmlKey = null;
			PRxmlNameSpace = null;
			PRisParsed = false;
            PRisProcessAttributes = false;

			// Value
			PRvalue = null;

			// dt attribute
			PRkeyDt = null;
			PRdtType = null;
            PRassemblyName = null;
			PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
			PRisEnum = false;			

			// Object ID
			PRobjectId = 0;

			// Reference ID
			PRidRef = 0;

			// Array

			// Array Element Type
			PRarrayElementTypeString = null;
			PRarrayElementType = null;
			PRisArrayVariant = false;
			PRarrayElementTypeCode = InternalPrimitiveTypeE.Invalid;


			// Array Primitive Element type
			PRprimitiveArrayTypeString = null;

			// Parsed array information
			PRrank = 0;
			PRlengthA = null;
			PRpositionA = null;
			PRlowerBoundA = null;
			PRupperBoundA = null;		

			// Array map for placing array elements in array
			PRindexMap = null;
			PRmemberIndex = 0;
			PRlinearlength = 0;
			PRrectangularMap = null;
			PRisLowerBound = false;

			// SerializedStreamHeader information
			PRtopId = 0;
			PRheaderId = 0;
			PRisHeaderRoot = false;
			PRisAttributesProcessed = false;

			// Parsed HeaderMember Information
			PRisMustUnderstand = false;

			// Parse State
			PRparseStateEnum = InternalParseStateE.Initial;
			PRisWaitingForNestedObject = false;


			// ValueType Fixup needed
			PRisValueTypeFixup = false;

			PRnewObj = null;
			PRobjectA = null;
			PRprimitiveArray = null;			
			PRobjectInfo = null;
			PRisRegistered = false;

			PRisXmlAttribute = false;
		}
 internal void Init()
 {
     this.PRparseTypeEnum = InternalParseTypeE.Empty;
     this.PRobjectTypeEnum = InternalObjectTypeE.Empty;
     this.PRarrayTypeEnum = InternalArrayTypeE.Empty;
     this.PRmemberTypeEnum = InternalMemberTypeE.Empty;
     this.PRmemberValueEnum = InternalMemberValueE.Empty;
     this.PRobjectPositionEnum = InternalObjectPositionE.Empty;
     this.PRname = null;
     this.PRnameXmlKey = null;
     this.PRxmlNameSpace = null;
     this.PRisParsed = false;
     this.PRisProcessAttributes = false;
     this.PRvalue = null;
     this.PRkeyDt = null;
     this.PRdtType = null;
     this.PRassemblyName = null;
     this.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
     this.PRisEnum = false;
     this.PRobjectId = 0L;
     this.PRidRef = 0L;
     this.PRarrayElementTypeString = null;
     this.PRarrayElementType = null;
     this.PRisArrayVariant = false;
     this.PRarrayElementTypeCode = InternalPrimitiveTypeE.Invalid;
     this.PRprimitiveArrayTypeString = null;
     this.PRrank = 0;
     this.PRlengthA = null;
     this.PRpositionA = null;
     this.PRlowerBoundA = null;
     this.PRupperBoundA = null;
     this.PRindexMap = null;
     this.PRmemberIndex = 0;
     this.PRlinearlength = 0;
     this.PRrectangularMap = null;
     this.PRisLowerBound = false;
     this.PRtopId = 0L;
     this.PRheaderId = 0L;
     this.PRisHeaderRoot = false;
     this.PRisAttributesProcessed = false;
     this.PRisMustUnderstand = false;
     this.PRparseStateEnum = InternalParseStateE.Initial;
     this.PRisWaitingForNestedObject = false;
     this.PRisValueTypeFixup = false;
     this.PRnewObj = null;
     this.PRobjectA = null;
     this.PRprimitiveArray = null;
     this.PRobjectInfo = null;
     this.PRisRegistered = false;
     this.PRisXmlAttribute = false;
 }