本文整理汇总了C#中System.Xml.XPath.XPathDocument.MoveToNext方法的典型用法代码示例。如果您正苦于以下问题:C# XPathDocument.MoveToNext方法的具体用法?C# XPathDocument.MoveToNext怎么用?C# XPathDocument.MoveToNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XPath.XPathDocument
的用法示例。
在下文中一共展示了XPathDocument.MoveToNext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromXml
internal static CngKey FromXml(string xml)
{
CngKey key;
using (TextReader reader = new StringReader(xml))
{
using (XmlTextReader reader2 = new XmlTextReader(reader))
{
BigInteger integer;
BigInteger integer2;
XPathNavigator navigator = new XPathDocument(reader2).CreateNavigator();
if (!navigator.MoveToFirstChild())
{
throw new ArgumentException(System.SR.GetString("Cryptography_MissingDomainParameters"));
}
CngAlgorithm algorithm = ReadAlgorithm(navigator);
if (!navigator.MoveToNext(XPathNodeType.Element))
{
throw new ArgumentException(System.SR.GetString("Cryptography_MissingPublicKey"));
}
ReadPublicKey(navigator, out integer, out integer2);
key = CngKey.Import(NCryptNative.BuildEccPublicBlob(algorithm.Algorithm, integer, integer2), CngKeyBlobFormat.EccPublicBlob);
}
}
return key;
}
示例2: SignificantWhitespaceConstruction
public void SignificantWhitespaceConstruction ()
{
string xml = @"<root>
<child xml:space='preserve'> <!-- --> </child>
<child xml:space='preserve'> </child>
</root>";
XPathNavigator nav = new XPathDocument (
new XmlTextReader (xml, XmlNodeType.Document, null),
XmlSpace.Preserve).CreateNavigator ();
nav.MoveToFirstChild ();
nav.MoveToFirstChild ();
Assert.AreEqual (XPathNodeType.Whitespace, nav.NodeType, "#1");
nav.MoveToNext ();
nav.MoveToFirstChild ();
Assert.AreEqual (XPathNodeType.SignificantWhitespace,
nav.NodeType, "#2");
}
示例3: PushInputDocument
public void PushInputDocument (string url)
{
// todo: detect recursion
Uri baseUriObj = (Input.BaseURI == String.Empty) ? null : new Uri (Input.BaseURI);
Uri absUri = res.ResolveUri (baseUriObj, url);
string absUriString = absUri != null ? absUri.ToString () : String.Empty;
using (Stream s = (Stream)res.GetEntity (absUri, null, typeof(Stream)))
{
if (s == null)
throw new XsltCompileException ("Can not access URI " + absUri.ToString (), null, Input);
XmlValidatingReader vr = new XmlValidatingReader (new XmlTextReader (absUriString, s, nsMgr.NameTable));
vr.ValidationType = ValidationType.None;
XPathNavigator n = new XPathDocument (vr, XmlSpace.Preserve).CreateNavigator ();
vr.Close ();
n.MoveToFirstChild ();
do {
if (n.NodeType == XPathNodeType.Element)
break;
} while (n.MoveToNext ());
PushInputDocument (n);
}
}
示例4: XPathDocumentFragmentLoading
public void XPathDocumentFragmentLoading()
{
string xml = "<customer id='1' pp:id='aba' xmlns='urn-kzu' xmlns:pp='urn-pepenamespace'><pp:order /><order id='1'>Chocolates</order></customer>";
XPathNavigator nav = new XPathDocument(new StringReader(xml)).CreateNavigator();
// <customer>
nav.MoveToFirstChild();
// <pp:order>
nav.MoveToFirstChild();
// <order>
nav.MoveToNext();
XmlReader reader = new XPathNavigatorReader(nav);
XPathNavigator clone = new XPathDocument(reader).CreateNavigator();
clone.MoveToFirstChild();
Assert.AreEqual("order", clone.LocalName);
Assert.AreEqual("urn-kzu", clone.NamespaceURI);
}
示例5: XmlDocumentFragmentLoading
public void XmlDocumentFragmentLoading()
{
string xml = "<customer id='1' pp:id='aba' xmlns='urn-kzu' xmlns:pp='urn-pepenamespace'><pp:order /><order id='1'>Chocolates</order></customer>";
XPathNavigator nav = new XPathDocument(new StringReader(xml)).CreateNavigator();
// <customer>
nav.MoveToFirstChild();
// <pp:order>
nav.MoveToFirstChild();
// <order>
nav.MoveToNext();
XmlReader reader = new XPathNavigatorReader(nav);
XmlDocument doc = new XmlDocument(nav.NameTable);
doc.Load( reader );
Assert.AreEqual("order", doc.DocumentElement.LocalName);
Assert.AreEqual("urn-kzu", doc.DocumentElement.NamespaceURI);
Assert.AreEqual(1, doc.DocumentElement.Attributes.Count);
}