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).

적용 대상

추가 정보