本文整理汇总了C#中System.Xml.IXmlNamespaceResolver.GetNamespacesInScope方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlNamespaceResolver.GetNamespacesInScope方法的具体用法?C# IXmlNamespaceResolver.GetNamespacesInScope怎么用?C# IXmlNamespaceResolver.GetNamespacesInScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.IXmlNamespaceResolver
的用法示例。
在下文中一共展示了IXmlNamespaceResolver.GetNamespacesInScope方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteNamespaces
public void WriteNamespaces (string defaultNamespace, NSResolver nsmgr, bool isData)
{
if (defaultNamespace == null)
defaultNamespace = String.Empty;
if (defaultNamespace.Length > 0)
w.WriteLine ("default namespace = {0}",
defaultNamespace);
if (nsmgr != null) {
#if NET_2_0
foreach (string s in nsmgr.GetNamespacesInScope (
XmlNamespaceScope.All).Keys) {
#else
foreach (string s in nsmgr) {
#endif
switch (s) {
case "xml":
case "xmlns":
continue;
case "":
if (defaultNamespace.Length > 0)
w.WriteLine ("default namespace = '{0}'",
nsmgr.LookupNamespace (s).Replace ('\'', '\"'));
break;
default:
w.WriteLine ("{2} {0} = '{1}'",
s,
nsmgr.LookupNamespace (s).Replace ('\'', '\"'),
isData ? "datatypes" : "namespace");
break;
}
}
}
w.WriteLine ();
}
#region Elements
// Note that it might not be used directly when a grammar
// contains more than one "start" (compact syntax does not
// support "combine" attribute).
public void WriteStart (RelaxngStart start)
{
w.Write ("start");
if (start.Combine == null)
w.Write (" = ");
else
w.Write (start.Combine.Trim () == "interleave" ?
" &= " : " |= ");
start.Pattern.WriteRnc (this);
w.WriteLine ();
}
示例2: WriteNamespaces
public void WriteNamespaces (string defaultNamespace, NSResolver nsmgr, bool isData)
{
if (defaultNamespace == null)
defaultNamespace = String.Empty;
if (defaultNamespace.Length > 0)
w.WriteLine ("default namespace = {0}",
defaultNamespace);
if (nsmgr != null) {
foreach (string s in nsmgr.GetNamespacesInScope (
XmlNamespaceScope.All).Keys) {
switch (s) {
case "xml":
case "xmlns":
continue;
case "":
if (defaultNamespace.Length > 0)
w.WriteLine ("default namespace = '{0}'",
nsmgr.LookupNamespace (s).Replace ('\'', '\"'));
break;
default:
w.WriteLine ("{2} {0} = '{1}'",
s,
nsmgr.LookupNamespace (s).Replace ('\'', '\"'),
isData ? "datatypes" : "namespace");
break;
}
}
}
w.WriteLine ();
}