本文整理汇总了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);
}
}
示例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;
}
}
示例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));
}
示例4: OnStartElement
public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
{
}
示例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;
}
}
示例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 ();
}
示例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 {
}
}
示例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;
}
示例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);
}
示例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;
//.........这里部分代码省略.........
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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 ();
}
示例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);
}