本文整理汇总了C#中System.Xml.XmlNamespaceManager.LookupPrefix方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNamespaceManager.LookupPrefix方法的具体用法?C# XmlNamespaceManager.LookupPrefix怎么用?C# XmlNamespaceManager.LookupPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNamespaceManager
的用法示例。
在下文中一共展示了XmlNamespaceManager.LookupPrefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlValidationRuleset
public XmlValidationRuleset(IXmlDocumentProvider docProvider, XmlNode node, XmlNamespaceManager nsmgr)
{
if (node.Attributes["name"] != null)
this.Name = node.Attributes["name"].Value;
if (node.Attributes["nameString"] != null)
this.NameString = node.Attributes["nameString"].Value;
if (node.Attributes["descriptionString"] != null)
this.DescriptionString = node.Attributes["descriptionString"].Value;
List<IValidationRule> rules = new List<IValidationRule>();
string prefix = nsmgr.LookupPrefix("http://icalvalid.wikidot.com/validation");
if (node.Attributes["basedOn"] != null)
{
// Inherit rules from the ruleset this one is based on.
string name = node.Attributes["basedOn"].Value;
foreach (XmlNode rule in node.SelectNodes("parent::" + prefix + ":rulesets/" + prefix + ":ruleset[@name='" + name + "']/" + prefix + ":rule", nsmgr))
rules.Add(new XmlValidationRule(docProvider, rule, nsmgr));
}
foreach (XmlNode rule in node.SelectNodes(prefix + ":rule", nsmgr))
rules.Add(new XmlValidationRule(docProvider, rule, nsmgr));
Rules = rules.ToArray();
}
示例2: XmlValidationRule
public XmlValidationRule(IXmlDocumentProvider docProvider, XmlNode node, XmlNamespaceManager nsmgr)
{
if (node.Attributes["name"] != null)
Name = node.Attributes["name"].Value;
if (node.Attributes["file"] != null)
File = node.Attributes["file"].Value;
if (!string.IsNullOrEmpty(File))
{
try
{
XmlDocument doc = docProvider.Load(File);
if (doc != null)
{
List<ITest> tests = new List<ITest>();
string prefix = nsmgr.LookupPrefix("http://icalvalid.wikidot.com/validation");
foreach (XmlNode passNode in doc.SelectNodes("/" + prefix + ":rule/" + prefix + ":pass", nsmgr))
tests.Add(new XmlCalendarTest(passNode, nsmgr));
foreach (XmlNode failNode in doc.SelectNodes("/" + prefix + ":rule/" + prefix + ":fail", nsmgr))
tests.Add(new XmlCalendarTest(failNode, nsmgr));
Tests = tests.ToArray();
}
else throw new ValidationRuleLoadException("The file could not be found at the following path: '" + File + "'.", this);
}
catch (ValidationRuleLoadException) { throw; }
catch
{
throw new ValidationRuleLoadException(this);
}
}
}
示例3: PerformQTConfigPatches
public static void PerformQTConfigPatches(string devenvroot, string agentExecutable, string subpath, IDictionary<Assembly, KeyValuePair<bool, bool?>> actions)
{
var agentConfigFile = Path.Combine(devenvroot, agentExecutable + ".config");
string ns = "urn:schemas-microsoft-com:asm.v1";
var x = new XmlDocument();
x.Load(agentConfigFile);
var nsm = new XmlNamespaceManager(x.NameTable);
var prf = nsm.LookupPrefix(ns);
if (string.IsNullOrEmpty(prf)) nsm.AddNamespace(prf = "asm1", ns);
bool changed = false;
foreach (var pair in actions)
{
var asm = pair.Key;
var cleanup = pair.Value.Key;
var newstate = pair.Value.Value;
var filepath = Path.Combine(subpath, Path.GetFileName(asm.Location));
if (cleanup) changed |= junkRemover(x, asm.GetName(), ns, prf, nsm);
if (newstate == true) changed |= exactWriter(x, filepath, asm.GetName(), ns, prf, nsm);
else if (newstate == false) changed |= exactRemover(x, filepath, asm.GetName(), ns, prf, nsm);
}
if (changed)
x.Save(agentConfigFile);
}
示例4: LoadFromXml
public override void LoadFromXml(XmlElement el, XmlNamespaceManager nsmgr)
{
base.LoadFromXml(el, nsmgr);
string pr = nsmgr.LookupPrefix(ProcessDefinition.WORKFLOW_NAMESPACE);
if (pr != null && pr.Length > 0) pr += ":";
VariableDir = (VariableDef.Dir)Enum.Parse(typeof(VariableDef.Dir), el.GetAttribute("dir"));
DefaultValueExpr = SchemaUtil.GetXmlElementText(el, pr + "defaultValue", nsmgr);
}
示例5: ResolveFullName
private string ResolveFullName(IXmlNode node, XmlNamespaceManager manager)
{
string str = node.NamespaceUri == null || node.LocalName == "xmlns" && node.NamespaceUri == "http://www.w3.org/2000/xmlns/" ? (string) null : manager.LookupPrefix(node.NamespaceUri);
if (!string.IsNullOrEmpty(str))
return str + ":" + node.LocalName;
else
return node.LocalName;
}
示例6: GetQName
public static string GetQName(XmlTextReader r, XmlNamespaceManager nsmgr)
{
string prefix = !String.IsNullOrEmpty(r.Prefix) ? r.Prefix : nsmgr.LookupPrefix(r.NamespaceURI);
if (!String.IsNullOrEmpty(prefix))
return prefix + ":" + r.LocalName;
else
return r.LocalName;
}
示例7: GetQName
public static string GetQName(XmlTextReader r, XmlNamespaceManager nsmgr)
{
string str = !string.IsNullOrEmpty(r.Prefix) ? r.Prefix : nsmgr.LookupPrefix(r.NamespaceURI);
if (!string.IsNullOrEmpty(str))
{
return (str + ":" + r.LocalName);
}
return r.LocalName;
}
示例8: LoadFromXml
public void LoadFromXml(XmlElement el, XmlNamespaceManager nsmgr)
{
string pr = nsmgr.LookupPrefix(XmlSchemaUtil.WORKFLOW_NAMESPACE);
if (pr != null && pr.Length > 0) pr += ":";
Name = el.GetAttribute("name");
foreach (XmlElement mel in el.SelectNodes(pr + "member", nsmgr))
{
MemberDef md = new MemberDef();
md.LoadFromXml(mel, nsmgr);
Members.Add(md);
}
}
示例9: LoadFromXml
public void LoadFromXml(XmlElement el, XmlNamespaceManager nsmgr)
{
string pr = nsmgr.LookupPrefix(XmlSchemaUtil.WORKFLOW_NAMESPACE);
if (pr != null && pr.Length > 0) pr += ":";
Name = el.GetAttribute("name");
foreach(XmlElement v in el.SelectNodes(pr + "value", nsmgr))
{
string sv = v.InnerText;
//object ev = Convert.ChangeType(sv, BaseType.ValueType);
EnumValues.Add(sv);
}
}
示例10: CheckQTConfigState
public static IDictionary<Assembly, KeyValuePair<bool, bool>> CheckQTConfigState(string devenvroot, string agentExecutable, string subpath, IEnumerable<Assembly> asms)
{
var agentConfigFile = Path.Combine(devenvroot, agentExecutable + ".config");
string ns = "urn:schemas-microsoft-com:asm.v1";
var x = new XmlDocument();
x.Load(agentConfigFile);
var nsm = new XmlNamespaceManager(x.NameTable);
var prf = nsm.LookupPrefix(ns);
if (string.IsNullOrEmpty(prf)) nsm.AddNamespace(prf = "asm1", ns);
var result = new Dictionary<Assembly, KeyValuePair<bool, bool>>();
foreach (var asm in asms)
{
var filepath = Path.Combine(subpath, Path.GetFileName(asm.Location));
bool needCleanup = junkRemover(x, asm.GetName(), ns, prf, nsm);
bool entryExists = exactFinder(x, filepath, asm.GetName(), ns, prf, nsm);
result.Add(asm, new KeyValuePair<bool, bool>(needCleanup, entryExists));
}
return result;
}
示例11: XFormGenerator
public XFormGenerator(XmlDocument skeleton, XmlNamespaceManager namespaceManager, XmlNode dataRoot, XmlNode templatesRoot, XmlNode labelsRoot, XmlNode stateRoot, XmlNode bindsRoot, XmlNode uiRoot)
{
xform = skeleton;
xformsNamespacePrefix = namespaceManager.LookupPrefix(xformsNamespace);
if(xformsNamespacePrefix == "")
{
xformsNamespacePrefix = "xforms";
namespaceManager.AddNamespace(xformsNamespacePrefix, xformsNamespace);
}
instanceGenerator = new InstanceGenerator(xform, dataRoot);
instanceHandler = (Handler)instanceGenerator;
templateGenerator = new InstanceGenerator(xform, templatesRoot);
templateHandler = (Handler)templateGenerator;
currentLabelsNode = labelsRoot;
currentStateNode = stateRoot;
currentBindsNode = bindsRoot;
currentUINode = uiRoot;
InitialiseCurrentLabelXPath();
}
示例12: XmlValidationRule
public XmlValidationRule(IXmlDocumentProvider docProvider, XmlNode node, XmlNamespaceManager nsmgr)
{
if (node.Attributes["name"] != null)
Name = node.Attributes["name"].Value;
if (node.Attributes["file"] != null)
File = node.Attributes["file"].Value;
if (!string.IsNullOrEmpty(File))
{
XmlDocument doc = docProvider.Load(File);
if (doc != null)
{
List<ITest> tests = new List<ITest>();
string prefix = nsmgr.LookupPrefix("http://icalvalid.wikidot.com/validation");
foreach (XmlNode passNode in doc.SelectNodes("/" + prefix + ":rule/" + prefix + ":pass", nsmgr))
tests.Add(new XmlCalendarTest(passNode, nsmgr));
foreach (XmlNode failNode in doc.SelectNodes("/" + prefix + ":rule/" + prefix + ":fail", nsmgr))
tests.Add(new XmlCalendarTest(failNode, nsmgr));
Tests = tests.ToArray();
}
}
}
示例13: AtomizedLookup
public void AtomizedLookup ()
{
if (DateTime.Now.Year == 0)
suffix = String.Empty;
XmlNamespaceManager nsmgr =
new XmlNamespaceManager (new NameTable ());
nsmgr.AddNamespace ("foo", "urn:foo");
Assert.IsNotNull (nsmgr.LookupPrefix ("urn:foo"));
// FIXME: This returns registered URI inconsistently.
// Assert.IsNull (nsmgr.LookupPrefix ("urn:f" + suffix), "It is not atomized and thus should be failed");
}
示例14: ApplySignboxMods
public static void ApplySignboxMods(XmlDocument document, XmlNamespaceManager xmlns)
{
var body = (XmlElement) document.DocumentElement.SelectSingleNode("//body");
var dialog = document.CreateElement("div");
dialog.SetAttribute("data-role", "page");
dialog.SetAttribute("id", "popup");
dialog.SetAttribute("data-theme", "c");
var header = document.CreateElement("div");
header.SetAttribute("data-role", "header");
header.SetAttribute("data-position", "inline");
var headerText = document.CreateElement("h1");
headerText.InnerText = "Signature Pad";
var clearButton = document.CreateElement("a");
clearButton.SetAttribute("id", "sigPadClearButton");
clearButton.SetAttribute("href", "#");
clearButton.SetAttribute("data-icon", "refresh");
clearButton.InnerText = "Clear";
var content = document.CreateElement("div");
content.SetAttribute("data-role", "content");
var form = document.CreateElement("form");
form.SetAttribute("method", "post");
form.SetAttribute("class", "sigPad");
form.SetAttribute("action", "#");
form.SetAttribute("id", "sigDialogPad");
var sigWrapper = document.CreateElement("div");
SetElementClass(sigWrapper, "sig");
SetElementClass(sigWrapper, "sigWrapper");
var sigCanvas = document.CreateElement("canvas");
SetElementClass(sigCanvas, "pad");
sigCanvas.SetAttribute("height", "200");
sigCanvas.SetAttribute("width", "500");
var sigInput = document.CreateElement("input");
sigInput.SetAttribute("type", "hidden");
sigInput.SetAttribute("name", "output");
sigInput.SetAttribute("class", "output");
var footer = document.CreateElement("div");
footer.SetAttribute("data-role", "footer");
var footerText = document.CreateElement("h4");
footerText.InnerText = "";
header.AppendChild(headerText);
header.AppendChild(clearButton);
sigWrapper.AppendChild(sigCanvas);
sigWrapper.AppendChild(sigInput);
form.AppendChild(sigWrapper);
content.AppendChild(form);
footer.AppendChild(footerText);
dialog.AppendChild(header);
dialog.AppendChild(content);
dialog.AppendChild(footer);
body.AppendChild(dialog);
var ns = xmlns.LookupPrefix(@"http://schemas.microsoft.com/office/infopath/2003");
var ctrlIdAttrName = ns + ":CtrlId";
var signpads = document.SelectNodes(String.Format("//object[@{0}:xctname='inkpicture']", ns), xmlns);
foreach ( XmlElement signpad in signpads )
{
/*
<a class="signLink" href="#popup" id="CTRL88_5" data-role="button" data-rel="dialog" data-transition="none">
<input type="hidden" class="output" />
<img class="preview"/>
</a
*/
var controlName = signpad.Attributes[ctrlIdAttrName].Value;
var styleAttr = signpad.Attributes["style"];
var style = new StyleAttributeString(styleAttr);
var parent = (XmlElement) signpad.ParentNode;
if ( parent.LocalName == "if" ) parent = (XmlElement) parent.ParentNode;
var button = document.CreateElement("a");
button.SetAttribute("class", "signLink");
button.SetAttribute("href", "#popup");
button.SetAttribute("id", controlName);
//button.SetAttribute("data-role", "button");
button.SetAttribute("data-rel", "dialog");
button.SetAttribute("data-transition", "none");
//button.InnerText = "Signature pad";
var input = document.CreateElement("input");
//.........这里部分代码省略.........
示例15: ResolveFullName
private string ResolveFullName(IXmlNode node, XmlNamespaceManager manager)
{
string prefix = (node.NamespaceURI == null || (node.LocalName == "xmlns" && node.NamespaceURI == "http://www.w3.org/2000/xmlns/"))
? null
: manager.LookupPrefix(node.NamespaceURI);
if (!string.IsNullOrEmpty(prefix))
return prefix + ":" + node.LocalName;
else
return node.LocalName;
}