當前位置: 首頁>>代碼示例>>C#>>正文


C# Xml.SmallXmlParser類代碼示例

本文整理匯總了C#中Mono.Xml.SmallXmlParser的典型用法代碼示例。如果您正苦於以下問題:C# SmallXmlParser類的具體用法?C# SmallXmlParser怎麽用?C# SmallXmlParser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SmallXmlParser類屬於Mono.Xml命名空間,在下文中一共展示了SmallXmlParser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnStartElement

        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            SecurityElement newel = new SecurityElement(name);

            if (root == null)
            {
                root = newel;
                current = newel;

            }
            else
            {
                SecurityElement parent = (SecurityElement)stack.Peek();
                parent.AddChild(newel);
            }

            stack.Push(newel);
            current = newel;
            // attributes
            int n = attrs.Length;

            for (int i = 0; i < n; i++)
            {
                string attrName = SecurityElement.Escape(attrs.GetName(i));
                string attrValue = SecurityElement.Escape(attrs.GetValue(i));
                current.AddAttribute(attrName, attrValue);
            }
        }
開發者ID:pjkui,項目名稱:behaviac,代碼行數:28,代碼來源:SecurityParser.cs

示例2: OnStartElement

 public void OnStartElement (string name, SmallXmlParser.IAttrList attrs) {
     if (reading) {
         currentName = name;
     } else if (name == seeking) {
         currentAttributes = new Dictionary<string, string>();
         for (int t = 0; t < attrs.Length; t++) {
             currentAttributes[attrs.Names[t]] = attrs.Values[t];
         }
         currentKvps = new Dictionary<string, string>();
         reading = true;
     }
 }
開發者ID:nhhoang,項目名稱:shooting,代碼行數:12,代碼來源:UnibillXmlParser.cs

示例3: ReadServiceWellKnown

		void ReadServiceWellKnown (SmallXmlParser.IAttrList attrs)
		{
			string objectUri = GetNotNull (attrs, "objectUri");
			string smode = GetNotNull (attrs, "mode");
			string type = GetNotNull (attrs, "type");
			string assm = ExtractAssembly (ref type);
			
			WellKnownObjectMode mode;
			if (smode == "SingleCall") mode = WellKnownObjectMode.SingleCall;
			else if (smode == "Singleton") mode = WellKnownObjectMode.Singleton;
			else throw new RemotingException ("wellknown object mode '" + smode + "' is invalid");
			
			typeEntries.Add (new WellKnownServiceTypeEntry (type, assm, objectUri, mode));
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:14,代碼來源:RemotingConfiguration.cs

示例4: OnStartElement

 public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
 {
 }
開發者ID:phpdiva,項目名稱:Synergy-repo,代碼行數:3,代碼來源:SmallXmlParser.cs

示例5: OnStartElement

		public void OnStartElement (string name, SmallXmlParser.IAttrList attrs)
		{
			switch (level) {
			case 0:
				if (name == "configuration")
					level++;
				break;
			case 1:
				if (name == "mscorlib")
					level++;
				break;
			case 2:
				if (name == "cryptographySettings")
					level++;
				break;
			case 3:
				if (name == "oidMap")
					level++;
				else if (name == "cryptoNameMapping")
					level++;
				break;
			case 4:
				if (name == "oidEntry") {
					oid [Get (attrs, "name")] = Get (attrs, "OID");
				} else if (name == "nameEntry") {
					names [Get (attrs, "name")] = Get (attrs, "class");
				} else if (name == "cryptoClasses") {
					level++;
				}
				break;
			case 5:
				if (name == "cryptoClass")
					classnames [attrs.Names[0]] = attrs.Values[0];
				break;
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:36,代碼來源:CryptoConfig.cs

示例6: OnEndParsing

		public void OnEndParsing (SmallXmlParser parser)
		{
			foreach (var kpv in names) {
				try {
					algorithms [kpv.Key] = Type.GetType (classnames [kpv.Value]);
				}
				catch {
				}
			}
			// matching is done, data no more required
			names.Clear ();
			classnames.Clear ();
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:13,代碼來源:CryptoConfig.cs

示例7: LoadConfig

	private static void LoadConfig (string filename, IDictionary<string,Type> algorithms, IDictionary<string,string> oid)
	{
		if (!File.Exists (filename))
			return;

		try {
			using (TextReader reader = new StreamReader (filename)) {
				CryptoHandler handler = new CryptoHandler (algorithms, oid);
				SmallXmlParser parser = new SmallXmlParser ();
				parser.Parse (reader, handler);
			}
		}
		catch {
		}
	}
開發者ID:Profit0004,項目名稱:mono,代碼行數:15,代碼來源:CryptoConfig.cs

示例8: GetNotNull

		string GetNotNull (SmallXmlParser.IAttrList attrs, string name)
		{
			string value = attrs.GetValue (name);
			if (value == null || value == "") 
				throw new RemotingException (name + " attribute is required");
			return value;
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:7,代碼來源:RemotingConfiguration.cs

示例9: ReadCustomProviderData

		void ReadCustomProviderData (string name, SmallXmlParser.IAttrList attrs)
		{
			SinkProviderData parent = (SinkProviderData) currentProviderData.Peek ();
			
			SinkProviderData data = new SinkProviderData (name);
			for (int i=0; i < attrs.Names.Length; ++i) 
				data.Properties [attrs.Names[i]] = attrs.GetValue (i);
				
			parent.Children.Add (data);
			currentProviderData.Push (data);
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:11,代碼來源:RemotingConfiguration.cs

示例10: ParseElement

		public void ParseElement (string name, SmallXmlParser.IAttrList attrs)
		{
			if (currentProviderData != null)
			{
				ReadCustomProviderData (name, attrs);
				return;
			}
			
			switch (name) 
			{
				case "application":
					ValidatePath (name, "system.runtime.remoting");
					if (attrs.Names.Length > 0)
						appName = attrs.Values[0];
					break;
					
				case "lifetime":
					ValidatePath (name, "application");
					ReadLifetine (attrs);
					break;
					
				case "channels":
					ValidatePath (name, "system.runtime.remoting", "application");
					break;
					
				case "channel":
					ValidatePath (name, "channels");
					if (currentXmlPath.IndexOf ("application") != -1)
						ReadChannel (attrs, false);
					else
						ReadChannel (attrs, true);
					break;
					
				case "serverProviders":
					ValidatePath (name, "channelSinkProviders", "channel");
					break;
					
				case "clientProviders":
					ValidatePath (name, "channelSinkProviders", "channel");
					break;
					
				case "provider":
				case "formatter":
					ProviderData prov;
					
					if (CheckPath ("application/channels/channel/serverProviders") ||
						CheckPath ("channels/channel/serverProviders"))
					{
						prov = ReadProvider (name, attrs, false);
						currentChannel.ServerProviders.Add (prov);
					}
					else if (CheckPath ("application/channels/channel/clientProviders") ||
						CheckPath ("channels/channel/clientProviders"))
					{
						prov = ReadProvider (name, attrs, false);
						currentChannel.ClientProviders.Add (prov);
					}
					else if (CheckPath ("channelSinkProviders/serverProviders"))
					{
						prov = ReadProvider (name, attrs, true);
						RemotingConfiguration.RegisterServerProviderTemplate (prov);
					}
					else if (CheckPath ("channelSinkProviders/clientProviders"))
					{
						prov = ReadProvider (name, attrs, true);
						RemotingConfiguration.RegisterClientProviderTemplate (prov);
					}
					else 
						ValidatePath (name);
					break;
					
				case "client":
					ValidatePath (name, "application");
					currentClientUrl = attrs.GetValue ("url");
					break;
					
				case "service":
					ValidatePath (name, "application");
					break;
					
				case "wellknown":
					ValidatePath (name, "client", "service");
					if (CheckPath ("client"))
						ReadClientWellKnown (attrs);
					else
						ReadServiceWellKnown (attrs);
					break;
					
				case "activated":
					ValidatePath (name, "client", "service");
					if (CheckPath ("client"))
						ReadClientActivated (attrs);
					else
						ReadServiceActivated (attrs);
					break;
					
				case "soapInterop":
					ValidatePath (name, "application");
					break;
					
//.........這裏部分代碼省略.........
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:101,代碼來源:RemotingConfiguration.cs

示例11: OnStartElement

		public void OnStartElement (string name, SmallXmlParser.IAttrList attrs)
		{
			try
			{
				if (currentXmlPath.StartsWith ("/configuration/system.runtime.remoting"))
					ParseElement (name, attrs);
					
				currentXmlPath += "/" + name;
			}
			catch (Exception ex)
			{
				throw new RemotingException ("Error in element " + name + ": " + ex.Message, ex);
			}
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:14,代碼來源:RemotingConfiguration.cs

示例12: LoadDefaultDelayedChannels

		internal static void LoadDefaultDelayedChannels ()
		{
			lock (channelTemplates)
			{
				if (defaultDelayedConfigRead || defaultConfigRead) return;
				
				SmallXmlParser parser = new SmallXmlParser ();
				using (TextReader rreader = new StreamReader (Environment.GetMachineConfigPath ())) {
					ConfigHandler handler = new ConfigHandler (true);
					parser.Parse (rreader, handler);
				}
				defaultDelayedConfigRead = true;
			}
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:14,代碼來源:RemotingConfiguration.cs

示例13: ReadConfigFile

		private static void ReadConfigFile (string filename)
		{
			try
			{
				SmallXmlParser parser = new SmallXmlParser ();
				using (TextReader rreader = new StreamReader (filename)) {
					ConfigHandler handler = new ConfigHandler (false);
					parser.Parse (rreader, handler);
				}
			}
			catch (Exception ex)
			{
				throw new RemotingException ("Configuration file '" + filename + "' could not be loaded: " + ex.Message, ex);
			}
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:15,代碼來源:RemotingConfiguration.cs

示例14: OnEndParsing

		public void OnEndParsing (SmallXmlParser parser)
		{
			foreach (DictionaryEntry de in names) {
				try {
					algorithms.Add (de.Key, classnames[de.Value]);
				}
				catch {
				}
			}
			// matching is done, data no more required
			names.Clear ();
			classnames.Clear ();
		}
開發者ID:runefs,項目名稱:Marvin,代碼行數:13,代碼來源:CryptoConfig.cs

示例15: ReadInteropXml

		void ReadInteropXml (SmallXmlParser.IAttrList attrs, bool isElement)
		{
			Type t = Type.GetType (GetNotNull (attrs, "clr"));
			string[] xmlName = GetNotNull (attrs, "xml").Split (',');
			string localName = xmlName [0].Trim ();
			string ns = xmlName.Length > 0 ? xmlName[1].Trim() : null;
			
			if (isElement) SoapServices.RegisterInteropXmlElement (localName, ns, t);
			else SoapServices.RegisterInteropXmlType (localName, ns, t);
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:10,代碼來源:RemotingConfiguration.cs


注:本文中的Mono.Xml.SmallXmlParser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。