本文整理匯總了C#中System.Xml.XPath.XPathNavigator.MoveToFirstChild方法的典型用法代碼示例。如果您正苦於以下問題:C# XPathNavigator.MoveToFirstChild方法的具體用法?C# XPathNavigator.MoveToFirstChild怎麽用?C# XPathNavigator.MoveToFirstChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XPath.XPathNavigator
的用法示例。
在下文中一共展示了XPathNavigator.MoveToFirstChild方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Traverse
private static void Traverse(TextWriter writer, XPathNavigator nav, int depth = 0)
{
var leadIn = new string(Constants.Tab, depth);
if (nav.NodeType == XPathNodeType.Root)
nav.MoveToFirstChild();
do
{
switch (nav.NodeType)
{
case XPathNodeType.Element:
WriteElement(writer, nav, depth, leadIn);
break;
case XPathNodeType.Text:
WriteTextData(writer, nav, leadIn);
break;
case XPathNodeType.Comment:
WriteComment(writer, nav, leadIn);
break;
default:
throw new InvalidDataException("Encountered unsupported node type of " + nav.NodeType);
}
} while (nav.MoveToNext());
}
示例2: LoadFromXPath
public void LoadFromXPath(XPathNavigator nav)
{
nav.MoveToFirstChild();
do
{
if (nav.Name == "Path") Path = XmlDecode(nav.Value);
else if (nav.Name == "Open") Open = nav.ValueAsBoolean;
else if (nav.Name == "ManualAdd") ManualAdd = nav.ValueAsBoolean;
} while (nav.MoveToNext());
}
示例3: EnumerateChildren
public static IEnumerable<XPathNavigator> EnumerateChildren(XPathNavigator navigator)
{
if (navigator.MoveToFirstChild())
{
do
{
yield return navigator;
} while (navigator.MoveToNext());
navigator.MoveToParent();
}
}
示例4: ExtractFromNavigator
internal static string ExtractFromNavigator(XPathNavigator nav)
{
nav.MoveToRoot();
if (nav.MoveToFirstChild())
{
string namespaceURI = nav.NamespaceURI;
if (!(nav.LocalName != "Envelope") && (!(namespaceURI != "http://schemas.xmlsoap.org/soap/envelope/") || !(namespaceURI != "http://www.w3.org/2003/05/soap-envelope")))
{
return namespaceURI;
}
}
return string.Empty;
}
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:13,代碼來源:XPathMessageFunctionSoapUri.cs
示例5: ReadXml
public void ReadXml(XPathNavigator node) {
if (node.MoveToFirstAttribute()) {
do {
if (String.IsNullOrEmpty(node.NamespaceURI)) {
switch (node.LocalName) {
case "method":
switch (node.Value) {
case "xml":
this.Method = XmlSerializationOptions.Methods.Xml;
break;
case "html":
this.Method = XmlSerializationOptions.Methods.Html;
break;
case "xhtml":
this.Method = XmlSerializationOptions.Methods.XHtml;
break;
case "text":
this.Method = XmlSerializationOptions.Methods.Text;
break;
}
break;
default:
break;
}
}
} while (node.MoveToNextAttribute());
node.MoveToParent();
}
if (node.MoveToFirstChild()) {
do {
if (node.NodeType == XPathNodeType.Element || node.NodeType == XPathNodeType.Text) {
this.Content = node.Clone();
break;
}
} while (node.MoveToNext());
node.MoveToParent();
}
}
示例6: MoveToBody
internal static bool MoveToBody(XPathNavigator nav)
{
nav.MoveToRoot();
if (nav.MoveToFirstChild())
{
string namespaceURI = nav.NamespaceURI;
if ((nav.LocalName != "Envelope") || ((namespaceURI != "http://schemas.xmlsoap.org/soap/envelope/") && (namespaceURI != "http://www.w3.org/2003/05/soap-envelope")))
{
return false;
}
if (nav.MoveToFirstChild())
{
do
{
if ((nav.LocalName == "Body") && (nav.NamespaceURI == namespaceURI))
{
return true;
}
}
while (nav.MoveToNext());
}
}
return false;
}
示例7: GetTweet
public Tweet GetTweet(XPathNavigator nav)
{
Tweet tweet = new Tweet();
nav.MoveToFirstChild(); tweet.createdAt = nav.Value;
nav.MoveToNext(); tweet.from = nav.Value;
nav.MoveToNext(); tweet.id = nav.Value;
nav.MoveToNext(); tweet.Latitude = nav.Value;
nav.MoveToNext(); tweet.Longitude = nav.Value;
nav.MoveToNext(); nav.MoveToNext(); nav.MoveToNext();
nav.MoveToNext(); tweet.SourceText = nav.Value;
nav.MoveToNext(); tweet.Text = nav.Value;
nav.MoveToNext();
nav.MoveToNext(); tweet.userName = nav.Value;
return tweet;
}
示例8: ExtractFromNavigator
internal static string ExtractFromNavigator(XPathNavigator nav)
{
string attribute = nav.GetAttribute(XPathMessageContext.Actor11A, "http://schemas.xmlsoap.org/soap/envelope/");
string str2 = nav.GetAttribute(XPathMessageContext.Actor12A, "http://www.w3.org/2003/05/soap-envelope");
nav.MoveToRoot();
nav.MoveToFirstChild();
if ((nav.LocalName == "Envelope") && (nav.NamespaceURI == "http://schemas.xmlsoap.org/soap/envelope/"))
{
return attribute;
}
if ((nav.LocalName == "Envelope") && (nav.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"))
{
return str2;
}
return string.Empty;
}
示例9: ResourceDataToDictionary
//creates a dictionary of values found in XML
private static Dictionary<string, string> ResourceDataToDictionary(XPathNavigator xPathNavigator)
{
Dictionary<string, string> dict = new Dictionary<string, string>();
if (xPathNavigator.MoveToFirstChild()) //children
{
dict.Add(xPathNavigator.Name, xPathNavigator.Value);
while (xPathNavigator.MoveToNext())
{
dict.Add(xPathNavigator.Name, xPathNavigator.Value);
}
}
xPathNavigator.MoveToParent();
return dict;
}
示例10: DisplayTree
/// <summary>
/// Walks the XPathNavigator tree recursively
/// </summary>
/// <param name="myXPathNavigator"></param>
public static void DisplayTree(XPathNavigator myXPathNavigator)
{
if (myXPathNavigator.HasChildren)
{
myXPathNavigator.MoveToFirstChild();
Format(myXPathNavigator);
DisplayTree(myXPathNavigator);
myXPathNavigator.MoveToParent();
}
while (myXPathNavigator.MoveToNext())
{
Format(myXPathNavigator);
DisplayTree(myXPathNavigator);
}
}
示例11: ExtractFromNavigator
internal static bool ExtractFromNavigator(XPathNavigator nav)
{
string str = XPathMessageFunctionActor.ExtractFromNavigator(nav);
nav.MoveToRoot();
if (nav.MoveToFirstChild() && (nav.LocalName == "Envelope"))
{
if (nav.NamespaceURI == "http://schemas.xmlsoap.org/soap/envelope/")
{
return (str == S11UltRec);
}
if (nav.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope")
{
return (str == S12UltRec);
}
}
return false;
}
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:17,代碼來源:XPathMessageFunctionIsActorUltimateReceiver.cs
示例12: ReadSubtree1
public void ReadSubtree1 ()
{
string xml = "<root/>";
nav = GetXmlDocumentNavigator (xml);
ReadSubtree1 (nav, "#1.");
nav.MoveToRoot ();
nav.MoveToFirstChild ();
ReadSubtree1 (nav, "#2.");
nav = GetXPathDocumentNavigator (document);
ReadSubtree1 (nav, "#3.");
nav.MoveToRoot ();
nav.MoveToFirstChild ();
ReadSubtree1 (nav, "#4.");
}
示例13: MoveToAddressingHeader
internal static bool MoveToAddressingHeader(XPathNavigator nav, string name)
{
if (MoveToHeader(nav))
{
if (!nav.MoveToFirstChild())
{
return false;
}
do
{
if ((nav.LocalName == name) && (((nav.NamespaceURI == "http://www.w3.org/2005/08/addressing") || (nav.NamespaceURI == "http://schemas.xmlsoap.org/ws/2004/08/addressing")) || (nav.NamespaceURI == "http://schemas.microsoft.com/ws/2005/05/addressing/none")))
{
return true;
}
}
while (nav.MoveToNext());
}
return false;
}
示例14: DavProperty
/// <summary>
/// WebDav Property.
/// </summary>
/// <param name="property"></param>
public DavProperty(XPathNavigator property)
{
if (property == null)
throw new ArgumentNullException("property", InternalFunctions.GetResourceString("ArgumentNullException", "Property"));
else if (property.NodeType != XPathNodeType.Element)
throw new ArgumentException(InternalFunctions.GetResourceString("XPathNavigatorElementArgumentException", "Property"), "property");
base.Name = property.LocalName;
base.Namespace = property.NamespaceURI;
if (property.HasAttributes)
{
//TODO: Support element attributes
//string _here = "";
//Add the attributes first
// foreach (XmlAttribute _xmlAttribute in property.Attributes)
// Attributes.Add(new DavPropertyAttribute(_xmlAttribute));
}
if (property.MoveToFirstChild())
{
if (property.NodeType == XPathNodeType.Element)
{
NestedProperties.Add(new DavProperty(property.Clone()));
while (property.MoveToNext())
{
if (property.NodeType == XPathNodeType.Element)
NestedProperties.Add(new DavProperty(property.Clone()));
}
}
else if (property.NodeType == XPathNodeType.Text)
{
base.Value = property.Value;
property.MoveToParent();
}
}
}
示例15: update
/// <summary>
/// Updates all of the <c>Torrent</c> object's properties.
/// </summary>
/// <param name="node">Torrent XML node</param>
public void update(XPathNavigator node)
{
node.MoveToFirstChild();
hash = node.Value;
node.MoveToNext();
status = Convert.ToInt64(node.Value);
node.MoveToNext();
name = node.Value;
node.MoveToNext();
size = Convert.ToInt64(node.Value);
node.MoveToNext();
percent_progress = Convert.ToInt64(node.Value);
// skip a tonne of properties
for (int i = 0; i < 17; i++) node.MoveToNext();
status_message = node.Value;
calculateStatus();
last_modified = DateTime.Now;
// be kind, rewind
node.MoveToParent();
}