本文整理汇总了C#中System.Xml.XmlElement.SelectSingleNode方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.SelectSingleNode方法的具体用法?C# XmlElement.SelectSingleNode怎么用?C# XmlElement.SelectSingleNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.SelectSingleNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunParameters
public RunParameters(XmlElement e, Provider<IAgent, string> agentProvider)
{
exePath = e.SelectSingleNode("./cmd").InnerText;
workingDirectory = e.SelectSingleNode("./dir").InnerText;
parameters = e.SelectSingleNode("./args").InnerText;
agent = agentProvider(e.SelectSingleNode("./agent").InnerText);
}
示例2: Load
/// <summary>
/// 從XML載入設定值
/// <![CDATA[
/// ]]>
/// </summary>
/// <param name="data"></param>
public void Load(XmlElement data)
{
RefStudentID = data.GetAttribute("RefStudentID");
Permanent = new AddressItem(data.SelectSingleNode("Permanent/Address") as XmlElement);
Mailing = new AddressItem(data.SelectSingleNode("Mailing/Address") as XmlElement);
Address1 = new AddressItem(null);
Address2 = new AddressItem(null);
Address3 = new AddressItem(null);
int index = 0;
foreach (XmlElement each in data.SelectNodes("Addresses/AddressList/Address"))
{
if (index == 0)
Address1 = new AddressItem(each);
if (index == 1)
Address2 = new AddressItem(each);
if (index == 2)
Address3 = new AddressItem(each);
index++;
}
}
示例3: XmlTabPage
/// <summary>
/// Initializes a new instance of the XmlTabPage class.
/// </summary>
/// <param name="definition">XML definition.</param>
internal XmlTabPage( XmlElement definition)
{
string name = definition.Attributes[ "name" ].Value;
string tooltip = definition.Attributes[ "tooltip" ].Value;
_tab = new TabPage();
_tab.Text = name;
_tab.ToolTipText = tooltip;
_tab.Tag = this;
_tab.DockPadding.All = Property.TabPadding;
XmlAttribute _modesAttr = null;
_invisibleElem = (XmlElement) definition.SelectSingleNode( "invisible", FormsNamespace.NamespaceManager );
if(_invisibleElem != null)
{
_modesAttr = _invisibleElem.Attributes[ "modes" ];
if(_modesAttr != null)
_invisibleModes = _modesAttr.Value.Split( ',' );
//Isto tem de estar aqui para não estourar mais à frente por "No registered property handler"
definition.RemoveChild(definition.SelectSingleNode( "invisible", FormsNamespace.NamespaceManager ));
}
_disabledElem = (XmlElement)definition.SelectSingleNode("disabled", FormsNamespace.NamespaceManager);
if (_disabledElem != null)
{
_modesAttr = _disabledElem.Attributes["modes"];
if (_modesAttr != null)
_disabledModes = _modesAttr.Value.Split(',');
//Isto tem de estar aqui para não estourar mais à frente por "No registered property handler"
definition.RemoveChild(definition.SelectSingleNode("disabled", FormsNamespace.NamespaceManager));
}
}
示例4: AttributeDefinition
public AttributeDefinition(IMetaModel metaModel, XmlElement element)
{
this.metaModel = metaModel;
token = element.GetAttribute("token");
TextBuilder.SplitPrefix(token, '.', out assetTypeToken, out name);
displayName = element.GetAttribute("displayname");
attributeType = (AttributeType)Enum.Parse(typeof(AttributeType), element.GetAttribute("attributetype"));
isReadonly = bool.Parse(element.GetAttribute("isreadonly"));
isRequired = bool.Parse(element.GetAttribute("isrequired"));
isMultivalue = bool.Parse(element.GetAttribute("ismultivalue"));
var baseelement = element.SelectSingleNode("Base") as XmlElement;
if (baseelement != null)
{
baseToken = baseelement.GetAttribute("tokenref");
}
var relatedelement = element.SelectSingleNode("RelatedAsset") as XmlElement;
if (relatedelement != null)
{
relatedAssetToken = relatedelement.GetAttribute("nameref");
}
((AssetType)AssetType).SaveAttributeDefinition(this);
}
示例5: WxEventMsg
public WxEventMsg(XmlElement element)
: base(element)
{
try
{
EventType = element.SelectSingleNode("Event").InnerText;
}
catch (Exception e)
{
if (element == null)
throw new Exception("Element is null"+e.Message);
throw new Exception("EventNode is null"+e.Message);
}
try
{
EventKey = element.SelectSingleNode("EventKey").InnerText;
}
catch (Exception)
{
string s = "";
foreach (XmlNode node in element.ChildNodes)
{
s += node.Name + "=" + node.InnerText + "|";
}
throw new Exception(s);
}
}
示例6: LoadXml
public void LoadXml(XmlElement value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
XmlNamespaceManager nsmgr = new XmlNamespaceManager(value.OwnerDocument.NameTable);
nsmgr.AddNamespace("enc", "http://www.w3.org/2001/04/xmlenc#");
XmlNode node = value.SelectSingleNode("enc:CipherValue", nsmgr);
XmlNode node2 = value.SelectSingleNode("enc:CipherReference", nsmgr);
if (node != null)
{
if (node2 != null)
{
throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Xml_CipherValueElementRequired"));
}
this.m_cipherValue = Convert.FromBase64String(System.Security.Cryptography.Xml.Utils.DiscardWhiteSpaces(node.InnerText));
}
else
{
if (node2 == null)
{
throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Xml_CipherValueElementRequired"));
}
this.m_cipherReference = new System.Security.Cryptography.Xml.CipherReference();
this.m_cipherReference.LoadXml((XmlElement) node2);
}
this.m_cachedXml = value;
}
示例7: SetUp
public void SetUp()
{
XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
treeViewContainerControl = new XmlTreeViewContainerControl();
treeView = treeViewContainerControl.TreeView;
treeViewContainerControl.LoadXml(GetXml(), completionDataProvider);
doc = treeViewContainerControl.Document;
clipboardHandler = treeViewContainerControl as IClipboardHandler;
htmlElement = doc.DocumentElement;
bodyElement = htmlElement.FirstChild as XmlElement;
paragraphElement = bodyElement.SelectSingleNode("p") as XmlElement;
paragraphText = paragraphElement.SelectSingleNode("text()") as XmlText;
bodyComment = bodyElement.SelectSingleNode("comment()") as XmlComment;
htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
htmlTreeNode.PerformInitialization();
bodyTreeNode = htmlTreeNode.FirstNode as XmlElementTreeNode;
bodyTreeNode.PerformInitialization();
bodyCommentTreeNode = bodyTreeNode.FirstNode as XmlCommentTreeNode;
paragraphTreeNode = bodyTreeNode.LastNode as XmlElementTreeNode;
paragraphTreeNode.PerformInitialization();
paragraphTextTreeNode = paragraphTreeNode.FirstNode as XmlTextTreeNode;
}
示例8: ZVTCommandEnvironment
public ZVTCommandEnvironment(XmlElement environmentConfig)
{
_environmentConfig = environmentConfig;
string transport = XmlHelper.ReadString(environmentConfig, "Transport");
if (transport == null)
throw new ArgumentException("No transport layer specified");
if (transport.Equals("serial", StringComparison.InvariantCultureIgnoreCase))
{
XmlElement serialConfig = (XmlElement)environmentConfig.SelectSingleNode("TransportSettings");
if(serialConfig == null)
throw new ArgumentException("No serial configuration specified");
_transport = new RS232Transport(serialConfig);
}
else if (transport.Equals("network", StringComparison.InvariantCultureIgnoreCase))
{
XmlElement networkConfig = (XmlElement)environmentConfig.SelectSingleNode("TransportSettings");
if (networkConfig == null)
throw new ArgumentException("No network configuration specified");
_transport = new NetworkTransport(networkConfig);
}
}
示例9: Sheet
public Sheet(XmlElement nParent)
{
Parent = nParent;
XmlNode wNode = Parent.SelectSingleNode("./AcSmAcDbLayoutReference");
layout = new Layout((XmlElement)wNode);
wNode = Parent.SelectSingleNode("./AcSmCustomPropertyBag");
wCustomPropertyBag = new CustomPropertyBag((XmlElement)wNode);
}
示例10: Init
public void Init()
{
base.InitFixture();
rootElement = editor.Document.DocumentElement;
bodyElement = (XmlElement)rootElement.FirstChild;
paragraphElement = (XmlElement)bodyElement.SelectSingleNode("p");
bodyComment = (XmlComment)bodyElement.SelectSingleNode("comment()");
paragraphText = (XmlText)paragraphElement.SelectSingleNode("text()");
}
示例11: Load
internal override void Load(XmlElement albumElement)
{
base.Load(albumElement);
artist = albumElement.SelectSingleNode("spotify:artist/spotify:name", NamespaceManager.Instance).InnerText;
// availability in countries
string availability = albumElement.SelectSingleNode("spotify:availability/spotify:territories", NamespaceManager.Instance).InnerText;
availableInTerritories = availability.Split(' ');
}
示例12: DirectoryControl
internal DirectoryControl(XmlElement el)
{
XmlAttribute attribute2;
this.directoryControlType = "";
this.directoryControlCriticality = true;
this.directoryControlServerSide = true;
XmlNamespaceManager dsmlNamespaceManager = NamespaceUtils.GetDsmlNamespaceManager();
XmlAttribute attribute = (XmlAttribute) el.SelectSingleNode("@dsml:criticality", dsmlNamespaceManager);
if (attribute == null)
{
attribute = (XmlAttribute) el.SelectSingleNode("@criticality", dsmlNamespaceManager);
}
if (attribute == null)
{
this.directoryControlCriticality = false;
}
else
{
string str = attribute.Value;
switch (str)
{
case "true":
case "1":
this.directoryControlCriticality = true;
goto Label_00B5;
}
if (!(str == "false") && !(str == "0"))
{
throw new DsmlInvalidDocumentException(System.DirectoryServices.Protocols.Res.GetString("BadControl"));
}
this.directoryControlCriticality = false;
}
Label_00B5:
attribute2 = (XmlAttribute) el.SelectSingleNode("@dsml:type", dsmlNamespaceManager);
if (attribute2 == null)
{
attribute2 = (XmlAttribute) el.SelectSingleNode("@type", dsmlNamespaceManager);
}
if (attribute2 == null)
{
throw new DsmlInvalidDocumentException(System.DirectoryServices.Protocols.Res.GetString("BadControl"));
}
this.directoryControlType = attribute2.Value;
XmlElement element = (XmlElement) el.SelectSingleNode("dsml:controlValue", dsmlNamespaceManager);
if (element != null)
{
try
{
this.directoryControlValue = Convert.FromBase64String(element.InnerText);
}
catch (FormatException)
{
throw new DsmlInvalidDocumentException(System.DirectoryServices.Protocols.Res.GetString("BadControl"));
}
}
}
示例13: DirectoryAttribute
internal DirectoryAttribute(XmlElement node)
{
this.attributeName = "";
string xpath = "@dsml:name";
string str2 = "@name";
XmlNamespaceManager dsmlNamespaceManager = NamespaceUtils.GetDsmlNamespaceManager();
XmlAttribute attribute = (XmlAttribute) node.SelectSingleNode(xpath, dsmlNamespaceManager);
if (attribute == null)
{
attribute = (XmlAttribute) node.SelectSingleNode(str2, dsmlNamespaceManager);
if (attribute == null)
{
throw new DsmlInvalidDocumentException(System.DirectoryServices.Protocols.Res.GetString("MissingSearchResultEntryAttributeName"));
}
this.attributeName = attribute.Value;
}
else
{
this.attributeName = attribute.Value;
}
XmlNodeList list = node.SelectNodes("dsml:value", dsmlNamespaceManager);
if (list.Count != 0)
{
foreach (XmlNode node2 in list)
{
XmlAttribute attribute2 = (XmlAttribute) node2.SelectSingleNode("@xsi:type", dsmlNamespaceManager);
if (attribute2 == null)
{
this.Add(node2.InnerText);
}
else if (string.Compare(attribute2.Value, "xsd:string", StringComparison.OrdinalIgnoreCase) == 0)
{
this.Add(node2.InnerText);
}
else if (string.Compare(attribute2.Value, "xsd:base64Binary", StringComparison.OrdinalIgnoreCase) == 0)
{
byte[] buffer;
string innerText = node2.InnerText;
try
{
buffer = Convert.FromBase64String(innerText);
}
catch (FormatException)
{
throw new DsmlInvalidDocumentException(System.DirectoryServices.Protocols.Res.GetString("BadBase64Value"));
}
this.Add(buffer);
}
else if (string.Compare(attribute2.Value, "xsd:anyURI", StringComparison.OrdinalIgnoreCase) == 0)
{
Uri uri = new Uri(node2.InnerText);
this.Add(uri);
}
}
}
}
示例14: GetFolderAttributesFromNode
protected override PaFolder GetFolderAttributesFromNode(XmlElement FolderElement)
{
// call the V2 implementation to load the values
PaFolder folder = base.GetFolderAttributesFromNode(FolderElement);
// V3 .dnn file format adds the optional businesscontrollerclass node to the folder node element
XmlElement businessControllerElement = (XmlElement)FolderElement.SelectSingleNode("businesscontrollerclass");
if (businessControllerElement != null)
{
folder.BusinessControllerClass = businessControllerElement.InnerText.Trim();
}
// V3 .dnn file format adds the optional friendlyname/foldername/modulename nodes to the folder node element
//For these new nodes the defaults are as follows
// <friendlyname>, <name>
// <foldernamee>, <name>, "MyModule"
// <modulename>, <friendlyname>, <name>
XmlElement friendlynameElement = (XmlElement)FolderElement.SelectSingleNode("friendlyname");
if (friendlynameElement != null)
{
folder.FriendlyName = friendlynameElement.InnerText.Trim();
folder.ModuleName = friendlynameElement.InnerText.Trim();
}
XmlElement foldernameElement = (XmlElement)FolderElement.SelectSingleNode("foldername");
if (foldernameElement != null)
{
folder.FolderName = foldernameElement.InnerText.Trim();
}
if (folder.FolderName == "")
{
folder.FolderName = "MyModule";
}
XmlElement modulenameElement = (XmlElement)FolderElement.SelectSingleNode("modulename");
if (modulenameElement != null)
{
folder.ModuleName = modulenameElement.InnerText.Trim();
}
// V4.3.6 .dnn file format adds the optional compatibleversions node to the folder node element
XmlElement compatibleVersionsElement = (XmlElement)(FolderElement.SelectSingleNode("compatibleversions"));
if (compatibleVersionsElement != null)
{
folder.CompatibleVersions = compatibleVersionsElement.InnerText.Trim();
}
// V4.4.0 .dnn file format adds the optional supportsprobingprivatepath node to the folder node element
XmlElement supportsProbingPrivatePath = (XmlElement)(FolderElement.SelectSingleNode("supportsprobingprivatepath"));
if (supportsProbingPrivatePath != null)
{
folder.SupportsProbingPrivatePath = Convert.ToBoolean(supportsProbingPrivatePath.InnerText.Trim());
}
return folder;
}
示例15: Load
internal override void Load(XmlElement trackElement)
{
base.Load(trackElement);
artist = trackElement.SelectSingleNode("spotify:artist/spotify:name", NamespaceManager.Instance).InnerText;
length = TimeSpan.FromSeconds(double.Parse(trackElement.SelectSingleNode("spotify:length", NamespaceManager.Instance).InnerText));
// *** JS addition - get where this is available so we can filter out tracks that won't play.
string availability = trackElement.SelectSingleNode("spotify:album/spotify:availability/spotify:territories", NamespaceManager.Instance).InnerText;
availableInTerritories = availability.Split(' ');
}