示例#1
0
        // Parses a global element declaration
        private void ParseElementDecl(URTNamespace parsingNamespace)
        {
            Util.Log("WsdlParser.ParseElementDecl");            
            // Obtain element name and its type
            String elmName = LookupAttribute(s_nameString, null, true);
            String elmNS = parsingNamespace.Name;
            String typeName = LookupAttribute(s_typeString, null, false);

            // Handle the anonymous types
            String typeNS;
            bool bEmbedded, bPrimitive;
            if (_XMLReader.IsEmptyElement == true)
            {
                // Non-anonymous type case
                // We cannot assert that the type attribute must have been present
                // due to the Object/ur-type case
                ResolveTypeAttribute(ref typeName, out typeNS, out bEmbedded, out bPrimitive);

                // Position to the next element
                ReadNextXmlElement();
            }
            else
            {
                // Anonymous type case
                typeNS = parsingNamespace.Name;
                typeName = parsingNamespace.GetNextAnonymousName();
                bEmbedded = true;
                bPrimitive = false;

                // Parse the type
                int curDepth = _XMLReader.Depth;
                ReadNextXmlElement();
                String elementName;
                while (_XMLReader.Depth > curDepth)
                {
                    elementName = _XMLReader.LocalName;
                    if (MatchingStrings(elementName, s_complexTypeString))
                    {
                        ParseComplexType(parsingNamespace, typeName);
                    }
                    else if (MatchingStrings(elementName, s_simpleTypeString))
                    {
                        ParseSimpleType(parsingNamespace, typeName);
                    }
                    else
                    {
                        // Ignore others elements such as annotations
                        SkipXmlElement();
                    }
                }
            }

            // Create a new global element under the current namespace
            parsingNamespace.AddElementDecl(new ElementDecl(elmName, elmNS, typeName, typeNS,
                                                            bPrimitive));

            return;
        }
 private void ParseElementDecl(URTNamespace parsingNamespace)
 {
     string str4;
     bool flag;
     bool flag2;
     string elmName = this.LookupAttribute(s_nameString, null, true);
     string name = parsingNamespace.Name;
     string typeName = this.LookupAttribute(s_typeString, null, false);
     if (this._XMLReader.IsEmptyElement)
     {
         this.ResolveTypeAttribute(ref typeName, out str4, out flag, out flag2);
         this.ReadNextXmlElement();
     }
     else
     {
         str4 = parsingNamespace.Name;
         typeName = parsingNamespace.GetNextAnonymousName();
         flag = true;
         flag2 = false;
         int depth = this._XMLReader.Depth;
         this.ReadNextXmlElement();
         while (this._XMLReader.Depth > depth)
         {
             string localName = this._XMLReader.LocalName;
             if (MatchingStrings(localName, s_complexTypeString))
             {
                 this.ParseComplexType(parsingNamespace, typeName);
             }
             else
             {
                 if (MatchingStrings(localName, s_simpleTypeString))
                 {
                     this.ParseSimpleType(parsingNamespace, typeName);
                     continue;
                 }
                 this.SkipXmlElement();
             }
         }
     }
     parsingNamespace.AddElementDecl(new ElementDecl(elmName, name, typeName, str4, flag2));
 }