예제 #1
0
파일: WsdlParser.cs 프로젝트: JianwenSun/cc
            // Removes the given type from the namespace
            internal void RemoveSimpleType(URTSimpleType type){
                Util.Log("URTNamespace.RemoveSimpleType "+type.Name+" SimpleType "+_name);              
                for (int i=0;i<_URTSimpleTypes.Count;i++)
                {
                    if (_URTSimpleTypes[i] == type)
                    {
                        _URTSimpleTypes[i] = null;
                        --_numURTSimpleTypes;
                        return;
                    }
                }

                throw new SUDSParserException(
                                             CoreChannel.GetResourceString("Remoting_Suds_TriedToRemoveNonexistentType"));
            }
예제 #2
0
파일: WsdlParser.cs 프로젝트: JianwenSun/cc
        /*
        // Parses encoding
        private void ParseEncoding(URTSimpleType parsingSimpleType)
        {
            Util.Log("WsdlParser.ParseEncoding URTSimpleType "+parsingSimpleType);                                              
            if (_XMLReader.IsEmptyElement == true)
            {
                // Get the encoding value
                String valueString = LookupAttribute(s_valueString, null, true);
                parsingSimpleType.Encoding = valueString;
            }
            else
            {
                throw new SUDSParserException(
                                             CoreChannel.GetResourceString("Remoting_Suds_EncodingMustBeEmpty"));
            }

            ReadNextXmlElement();
            return;
        }
        */

        // Parses enumeration
        private void ParseEnumeration(URTSimpleType parsingSimpleType, int enumFacetNum)
        {
            Util.Log("WsdlParser.ParseEnumeration facitNum "+enumFacetNum);
            if (_XMLReader.IsEmptyElement == true)
            {
                // Get the enum value
                String valueString = LookupAttribute(s_valueString, null, true);
                parsingSimpleType.IsEnum = true;
                parsingSimpleType.AddFacet(new EnumFacet(valueString, enumFacetNum));
            }
            else
            {
                throw new SUDSParserException(
                                             CoreChannel.GetResourceString("Remoting_Suds_EnumMustBeEmpty"));
            }
            return;
        }
예제 #3
0
파일: WsdlParser.cs 프로젝트: JianwenSun/cc
 // Add a new type into the namespace
 internal void AddSimpleType(URTSimpleType type){
     Util.Log("URTNamespace.AddSimpleType "+type.Name);              
     // Assert that simple and complex types share the same namespace
     Debug.Assert(LookupComplexType(type.Name) == null,
                  "Simple type has the same name as a complex type");
     _URTSimpleTypes.Add(type);
     ++_numURTSimpleTypes;
 }
예제 #4
0
파일: WsdlParser.cs 프로젝트: JianwenSun/cc
        // Parses simple types
        private URTSimpleType ParseSimpleType(URTNamespace parsingNamespace, String typeName)
        {
            Util.Log("WsdlParser.ParseSimpleType NS "+parsingNamespace+" typeName "+typeName);                                              
            // Lookup the name of the type and the base type from which it derives
            if (typeName == null)
                typeName = LookupAttribute(s_nameString, null, true);
            String enumType = LookupAttribute(s_enumTypeString, s_wsdlSudsNamespaceString, false);
            URTSimpleType parsingSimpleType = parsingNamespace.LookupSimpleType(typeName);
            if (parsingSimpleType == null)
            {
                parsingSimpleType = new URTSimpleType(typeName, parsingNamespace.Name, parsingNamespace.Namespace,
                                                      parsingNamespace.EncodedNS, typeName != null, this);
                String baseType = LookupAttribute(s_baseString, null, false);
                if (!MatchingStrings(baseType, s_emptyString))
                {
                    String baseNS = ParseQName(ref baseType, parsingNamespace);
                    parsingSimpleType.Extends(baseType, baseNS);
                }
                parsingNamespace.AddSimpleType(parsingSimpleType);

                int curDepth = _XMLReader.Depth;
                ReadNextXmlElement();

                //int enumFacetNum = 0;
                string elementName;
                while (_XMLReader.Depth > curDepth)
                {
                    elementName = _XMLReader.LocalName;

                    if (MatchingStrings(elementName, s_restrictionString))
                    {
                        ParseRestrictionField(parsingNamespace, parsingSimpleType);
                    }
                    /*
                    else if (MatchingStrings(elementName, s_encodingString))
                    {
                        ParseEncoding(parsingSimpleType);
                    }
                    */
                    else
                    {
                        SkipXmlElement();
                    }
                }
            }
            else
            {
                SkipXmlElement();
            }
            if (enumType != null)
                parsingSimpleType.EnumType = enumType;

            return(parsingSimpleType);
        }
 private URTSimpleType ParseSimpleType(URTNamespace parsingNamespace, string typeName)
 {
     if (typeName == null)
     {
         typeName = this.LookupAttribute(s_nameString, null, true);
     }
     string str = this.LookupAttribute(s_enumTypeString, s_wsdlSudsNamespaceString, false);
     URTSimpleType simpleType = parsingNamespace.LookupSimpleType(typeName);
     if (simpleType == null)
     {
         simpleType = new URTSimpleType(typeName, parsingNamespace.Name, parsingNamespace.Namespace, parsingNamespace.EncodedNS, typeName != null, this);
         string left = this.LookupAttribute(s_baseString, null, false);
         if (!MatchingStrings(left, s_emptyString))
         {
             string baseTypeNS = this.ParseQName(ref left, parsingNamespace);
             simpleType.Extends(left, baseTypeNS);
         }
         parsingNamespace.AddSimpleType(simpleType);
         int depth = this._XMLReader.Depth;
         this.ReadNextXmlElement();
         while (this._XMLReader.Depth > depth)
         {
             if (MatchingStrings(this._XMLReader.LocalName, s_restrictionString))
             {
                 this.ParseRestrictionField(parsingNamespace, simpleType);
             }
             else
             {
                 this.SkipXmlElement();
             }
         }
     }
     else
     {
         this.SkipXmlElement();
     }
     if (str != null)
     {
         simpleType.EnumType = str;
     }
     return simpleType;
 }
 private void ParseEnumeration(URTSimpleType parsingSimpleType, int enumFacetNum)
 {
     if (!this._XMLReader.IsEmptyElement)
     {
         throw new SUDSParserException(CoreChannel.GetResourceString("Remoting_Suds_EnumMustBeEmpty"));
     }
     string valueString = this.LookupAttribute(s_valueString, null, true);
     parsingSimpleType.IsEnum = true;
     parsingSimpleType.AddFacet(new EnumFacet(valueString, enumFacetNum));
 }
예제 #7
0
        // Parses encoding
        private void ParseEncoding(URTSimpleType parsingSimpleType)
        {
            Util.Log("SdlParser.ParseEncoding URTSimpleType "+parsingSimpleType);                                               
            if(_XMLReader.IsEmptyElement == true)
            {
                // Get the encoding value
                String valueString = LookupAttribute(s_valueString, null, true);
                parsingSimpleType.Encoding = valueString;
            }
            else
            {
                throw new SUDSParserException(
                    CoreChannel.GetResourceString("Remoting_Suds_EncodingMustBeEmpty"));
            }

            ReadNextXmlElement();
            return;
        }
예제 #8
0
        // Parses simple types
        private URTSimpleType ParseSimpleType(URTNamespace parsingNamespace, String typeName)
        {
            Util.Log("SdlParser.ParseSimpleType NS "+parsingNamespace+" typeName "+typeName);                                               
            // Lookup the name of the type and the base type from which it derives
            if(typeName == null)
                typeName = LookupAttribute(s_nameString, null, true);
            URTSimpleType parsingSimpleType = parsingNamespace.LookupSimpleType(typeName);
            if(parsingSimpleType == null)
            {
                parsingSimpleType = new URTSimpleType(typeName, parsingNamespace.Namespace,
                                                      parsingNamespace.EncodedNS, typeName != null);
                String baseType = LookupAttribute(s_baseString, null, false);
                if(!MatchingStrings(baseType, s_emptyString))
                {
                    String baseNS = ParseQName(ref baseType);
                    parsingSimpleType.Extends(baseType, baseNS);
                }
                parsingNamespace.AddSimpleType(parsingSimpleType);

                int curDepth = _XMLReader.Depth;
                ReadNextXmlElement();

                int enumFacetNum = 0;
                string elementName;
                while(_XMLReader.Depth > curDepth)
                {
                    elementName = _XMLReader.LocalName;

                    // The only facet we currently support is enumeration
                    if(MatchingStrings(elementName, s_enumerationString))
                    {
                        ParseEnumeration(parsingSimpleType, enumFacetNum);
                        ++enumFacetNum;
                    }
                    else if(MatchingStrings(elementName, s_encodingString))
                    {
                        ParseEncoding(parsingSimpleType);
                    }
                    else
                    {
                        SkipXmlElement();
                    }
                }
            }
            else
            {
                SkipXmlElement();
            }

            return(parsingSimpleType);
        }