本文整理汇总了C#中System.Xml.XPath.XPathNavigator.MoveToRoot方法的典型用法代码示例。如果您正苦于以下问题:C# XPathNavigator.MoveToRoot方法的具体用法?C# XPathNavigator.MoveToRoot怎么用?C# XPathNavigator.MoveToRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XPath.XPathNavigator
的用法示例。
在下文中一共展示了XPathNavigator.MoveToRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMovingToRootItem
protected virtual void OnMovingToRootItem(XPathNavigator navigator)
{
navigator.MoveToRoot();
if (!navigator.MoveToFirstChild())
throw new InvalidXmlException("Expected node n2 not found");
if (!navigator.MoveToFirstChild())
throw new InvalidXmlException("Expected node item not found");
}
示例2: 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
示例3: 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;
}
示例4: 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
示例5: 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.");
}
示例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: ExtractFromNavigator
internal static string ExtractFromNavigator(XPathNavigator nav)
{
string actor11 = nav.GetAttribute(XPathMessageContext.Actor11A, XPathMessageContext.S11NS);
string actor12 = nav.GetAttribute(XPathMessageContext.Actor12A, XPathMessageContext.S12NS);
nav.MoveToRoot();
nav.MoveToFirstChild();
if (nav.LocalName == XPathMessageContext.EnvelopeE && nav.NamespaceURI == XPathMessageContext.S11NS)
{
return actor11;
}
else if (nav.LocalName == XPathMessageContext.EnvelopeE && nav.NamespaceURI == XPathMessageContext.S12NS)
{
return actor12;
}
return string.Empty;
}
示例8: setContext
internal override void setContext( XPathNavigator e) {
Debug.Assert(e != null);
e = e.Clone();
e.MoveToRoot();
base.setContext( e);
}
示例9: XmlSimpleElementContent
private void XmlSimpleElementContent (XPathNavigator nav)
{
AssertNavigator (nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
Assert (nav.MoveToFirstChild ());
AssertNavigator (nav, XPathNodeType.Element, "", "foo", "", "foo", "", false, true, false);
Assert (!nav.MoveToNext ());
Assert (!nav.MoveToPrevious ());
Assert (nav.MoveToFirstChild ());
AssertNavigator (nav, XPathNodeType.Element, "", "bar", "", "bar", "", false, false, true);
Assert (nav.MoveToParent ());
AssertNavigator (nav, XPathNodeType.Element, "", "foo", "", "foo", "", false, true, false);
nav.MoveToRoot ();
AssertNavigator (nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
Assert (!nav.MoveToNext ());
}
示例10: NavigateSprts
IEnumerable<FootballEvent> NavigateSprts(XPathNavigator nav)
{
// move to the root and the first element - <books>
nav.MoveToRoot();
var sports = nav.Select("//rsp/fd/sports/sport");
while (sports.MoveNext())
{
var sport = sports.Current;
var sportName = _sportKindResonlver(GetIdFromNode(sport));
var leagues = sport.Select("leagues/league");
while (leagues.MoveNext())
{
var leagueName = _leagueNameResolver(GetIdFromNode(leagues.Current));
var events = leagues.Current.Select("events/event");
while (events.MoveNext())
{
var @event = events.Current;
var eventid = GetIdFromNode(@event);
var when = DateTimeOffset.Parse(GetChildNodeValue(@event, "startDateTime").First());
var homeTeam = GetChildNodeValue(@event, "homeTeam/name").First();
var awayTeam = GetChildNodeValue(@event, "awayTeam/name").First();
var periods = @event.Select("periods/period");
var pperiods = ParsePeriods(periods).ToArray();
yield return new FootballEvent { AwayTeam = awayTeam, HomeTeam = homeTeam, League = leagueName, Sport = sportName, Periods = pperiods, When = when };
}
}
}
}
示例11: MoveToBody
internal static bool MoveToBody(XPathNavigator nav)
{
nav.MoveToRoot();
if (!nav.MoveToFirstChild())
{
return false;
}
string ns = nav.NamespaceURI;
if (nav.LocalName != XPathMessageContext.EnvelopeE || (ns != XPathMessageContext.S11NS && ns != XPathMessageContext.S12NS))
{
return false;
}
if (!nav.MoveToFirstChild())
{
return false;
}
do
{
if (nav.LocalName == XPathMessageContext.BodyE && nav.NamespaceURI == ns)
{
return true;
}
} while (nav.MoveToNext());
return false;
}
示例12: XmlRootElementOnly
private void XmlRootElementOnly (XPathNavigator nav)
{
AssertNavigator ("#1", nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
Assert.IsTrue (nav.MoveToFirstChild ());
AssertNavigator ("#2", nav, XPathNodeType.Element, "", "foo", "", "foo", "", false, false, true);
Assert.IsTrue (!nav.MoveToFirstChild ());
Assert.IsTrue (!nav.MoveToNext ());
Assert.IsTrue (!nav.MoveToPrevious ());
nav.MoveToRoot ();
AssertNavigator ("#3", nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
Assert.IsTrue (!nav.MoveToNext ());
}
示例13: DocumentWithXmlDeclaration
public void DocumentWithXmlDeclaration ()
{
document.LoadXml ("<?xml version=\"1.0\" standalone=\"yes\"?><Root><foo>bar</foo></Root>");
navigator = document.CreateNavigator ();
navigator.MoveToRoot ();
navigator.MoveToFirstChild ();
Assert.AreEqual (XPathNodeType.Element, navigator.NodeType, "#1");
Assert.AreEqual ("Root", navigator.Name, "#2");
}
示例14: AttributesAndNamespaces
[Category ("NotDotNet")] // MS bug
public void AttributesAndNamespaces ()
{
string xml = "<root attr='value' x:a2='v2' xmlns:x='urn:foo' xmlns='urn:default'></root>";
nav = GetXmlDocumentNavigator (xml);
AttributesAndNamespaces (nav, "#1.");
nav.MoveToRoot ();
nav.MoveToFirstChild ();
AttributesAndNamespaces (nav, "#2.");
nav = GetXPathDocumentNavigator (document);
AttributesAndNamespaces (nav, "#3.");
nav.MoveToRoot ();
nav.MoveToFirstChild ();
AttributesAndNamespaces (nav, "#4.");
}
示例15: DocElem_OpenClose_Attribute
public void DocElem_OpenClose_Attribute ()
{
string xml = "<root attr='value'></root>";
nav = GetXmlDocumentNavigator (xml);
DocElem_OpenClose_Attribute (nav, "#1.");
nav.MoveToRoot ();
nav.MoveToFirstChild ();
DocElem_OpenClose_Attribute (nav, "#2.");
nav = GetXPathDocumentNavigator (document);
DocElem_OpenClose_Attribute (nav, "#3.");
nav.MoveToRoot ();
nav.MoveToFirstChild ();
DocElem_OpenClose_Attribute (nav, "#4.");
}