本文整理汇总了C#中Mono.Xml.SmallXmlParser类的典型用法代码示例。如果您正苦于以下问题:C# SmallXmlParser类的具体用法?C# SmallXmlParser怎么用?C# SmallXmlParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmallXmlParser类属于Mono.Xml命名空间,在下文中一共展示了SmallXmlParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ReadLifetine
void ReadLifetine (SmallXmlParser.IAttrList attrs)
{
for (int i=0; i < attrs.Names.Length; ++i) {
switch (attrs.Names[i]) {
case "leaseTime":
LifetimeServices.LeaseTime = ParseTime (attrs.GetValue(i));
break;
case "sponsorshipTimeout":
LifetimeServices.SponsorshipTimeout = ParseTime (attrs.GetValue(i));
break;
case "renewOnCallTime":
LifetimeServices.RenewOnCallTime = ParseTime (attrs.GetValue(i));
break;
case "leaseManagerPollTime":
LifetimeServices.LeaseManagerPollTime = ParseTime (attrs.GetValue(i));
break;
default:
throw new RemotingException ("Invalid attribute: " + attrs.Names[i]);
}
}
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:21,代码来源:RemotingConfiguration.cs
示例17: ReadPreload
void ReadPreload (SmallXmlParser.IAttrList attrs)
{
string type = attrs.GetValue ("type");
string assm = attrs.GetValue ("assembly");
if (type != null && assm != null)
throw new RemotingException ("Type and assembly attributes cannot be specified together");
if (type != null)
SoapServices.PreLoad (Type.GetType (type));
else if (assm != null)
SoapServices.PreLoad (Assembly.Load (assm));
else
throw new RemotingException ("Either type or assembly attributes must be specified");
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:15,代码来源:RemotingConfiguration.cs
示例18: ReadChannel
void ReadChannel (SmallXmlParser.IAttrList attrs, bool isTemplate)
{
ChannelData channel = new ChannelData ();
for (int i=0; i < attrs.Names.Length; ++i)
{
string at = attrs.Names[i];
string val = attrs.Values[i];
if (at == "ref" && !isTemplate)
channel.Ref = val;
else if (at == "delayLoadAsClientChannel")
channel.DelayLoadAsClientChannel = val;
else if (at == "id" && isTemplate)
channel.Id = val;
else if (at == "type")
channel.Type = val;
else
channel.CustomProperties.Add (at, val);
}
if (isTemplate)
{
if (channel.Id == null) throw new RemotingException ("id attribute is required");
if (channel.Type == null) throw new RemotingException ("id attribute is required");
RemotingConfiguration.RegisterChannelTemplate (channel);
}
else
channelInstances.Add (channel);
currentChannel = channel;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:32,代码来源:RemotingConfiguration.cs
示例19: OnEndParsing
public void OnEndParsing (SmallXmlParser parser)
{
RemotingConfiguration.RegisterChannels (channelInstances, onlyDelayedChannels);
if (appName != null) RemotingConfiguration.ApplicationName = appName;
if (!onlyDelayedChannels)
RemotingConfiguration.RegisterTypes (typeEntries);
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:RemotingConfiguration.cs
示例20: ReadProvider
ProviderData ReadProvider (string name, SmallXmlParser.IAttrList attrs, bool isTemplate)
{
ProviderData prov = (name == "provider") ? new ProviderData () : new FormatterData ();
SinkProviderData data = new SinkProviderData ("root");
prov.CustomData = data.Children;
currentProviderData = new Stack ();
currentProviderData.Push (data);
for (int i=0; i < attrs.Names.Length; ++i)
{
string at = attrs.Names[i];
string val = attrs.Values[i];
if (at == "id" && isTemplate)
prov.Id = val;
else if (at == "type")
prov.Type = val;
else if (at == "ref" && !isTemplate)
prov.Ref = val;
else
prov.CustomProperties.Add (at, val);
}
if (prov.Id == null && isTemplate) throw new RemotingException ("id attribute is required");
return prov;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:27,代码来源:RemotingConfiguration.cs
注:本文中的Mono.Xml.SmallXmlParser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论