XmlNode.CreateNavigator XmlNode.CreateNavigator XmlNode.CreateNavigator XmlNode.CreateNavigator Method

定義

このオブジェクト内を移動するための XPathNavigator を作成します。Creates an XPathNavigator for navigating this object.

public:
 virtual System::Xml::XPath::XPathNavigator ^ CreateNavigator();
public virtual System.Xml.XPath.XPathNavigator CreateNavigator ();
abstract member CreateNavigator : unit -> System.Xml.XPath.XPathNavigator
override this.CreateNavigator : unit -> System.Xml.XPath.XPathNavigator
Public Overridable Function CreateNavigator () As XPathNavigator

戻り値

ノードに移動するために使用される XPathNavigator オブジェクト。An XPathNavigator object used to navigate the node. XPathNavigator は、メソッドの呼び出し元のノードに配置されます。The XPathNavigator is positioned on the node from which the method was called. ドキュメントのルートには配置されません。It is not positioned on the root of the document.

実装

次の例では、読み込みを XSLT 変換を実行する前に XML ドキュメントを編集します。The following example loads and edits an XML document before performing an XSLT transform.

XmlDocument^ doc = gcnew XmlDocument;
doc->Load( "books.xml" );

// Modify the XML file.
XmlElement^ root = doc->DocumentElement;
root->FirstChild->LastChild->InnerText = "12.95";

// Create an XPathNavigator to use for the transform.
XPathNavigator^ nav = root->CreateNavigator();

// Transform the file.
XslTransform^ xslt = gcnew XslTransform;
xslt->Load( "output.xsl" );
XmlTextWriter^ writer = gcnew XmlTextWriter( "books.html", nullptr );
xslt->Transform( nav, nullptr, writer, nullptr);
XmlDocument doc = new XmlDocument();
doc.Load("books.xml");

// Modify the XML file.
XmlElement root = doc.DocumentElement;
root.FirstChild.LastChild.InnerText = "12.95";

// Create an XPathNavigator to use for the transform.
XPathNavigator nav = root.CreateNavigator();

// Transform the file.
XslTransform xslt = new XslTransform();
xslt.Load("output.xsl");
XmlTextWriter writer = new XmlTextWriter("books.html", null);
xslt.Transform(nav, null, writer, null);
Dim doc as XmlDocument = new XmlDocument()
doc.Load("books.xml")

' Modify the XML file.
Dim root as XmlElement = doc.DocumentElement
root.FirstChild.LastChild.InnerText = "12.95"

' Create an XPathNavigator to use for the transform.
Dim nav as XPathNavigator = root.CreateNavigator()

' Transform the file.
Dim xslt as XslTransform = new XslTransform()
xslt.Load("output.xsl")
Dim writer as XmlTextWriter = new XmlTextWriter("books.html", nothing)
xslt.Transform(nav,nothing, writer, nothing)

注釈

XPathNavigatorデータへの読み取り専用のランダム アクセスを提供します。The XPathNavigator provides read-only, random access to data. XSLT 変換用に最適化された、入力メカニズムとして使用するとパフォーマンス上の利点を提供します、XslTransform.Transformメソッド。Because it is optimized for XSLT transformations, it provides performance benefits when used as an input mechanism to the XslTransform.Transform method.

このメソッドは、ドキュメント オブジェクト モデル (DOM) に Microsoft 拡張機能です。This method is a Microsoft extension to the Document Object Model (DOM).

適用対象

こちらもご覧ください