vb高手帮忙翻译一段英文

来源:百度知道 编辑:UC知道 时间:2024/06/08 19:20:16
程序例子就不翻译了
SetValue( )

This method inserts a new value in the current element, replacing the existing value.

DeleteCurrent( )

This method removes the current node from the document.

Remember, you have two basic choices for creating an XPathNavigator:

Use the XPathDocument.CreateNavigator( ) method

This method returns an XPathNavigator for the whole document. You can then move to the portion of the document you want to change.

Use the XPathDocument.Select( ) method with an XPath expression

This returns an XPathNodeIterator that allows you to move through your results, retrieving an XPathNavigator for each selected node.

Example 5-12 modifies the XML document shown in Example 5-10. It increases all the prices by 10% and then deletes nodes that don't fall into the Tools category. Finally, it displays the altered XML document.

Example 5-12. Modifying an XML document with XP

SetValue () 这个方法在现行元素插入新的价值,替换现有的价值。 DeleteCurrent () 这个方法从本文去除当前结。 记住,您有创造的XPathNavigator二个基本的选择: 使用XPathDocument.CreateNavigator ()方法 这个方法退回整体文件的XPathNavigator。 您能然后移动向您想要改变本文的部分。 使用与XPath表示的XPathDocument.Select ()方法 这退回允许您通过您的结果移动的XPathNodeIterator,检索每个所选节点的XPathNavigator。 例子5-12修改在例子显示的XML文件5-10。 它增加所有价格10%然后删除don'的结; t归入工具类别。 终于,它显示修改过的XML文件。 例子5-12。 修改与XPathNavigator的一个XML文件 当您跑这种应用时,被改变的文件的XML在控制台窗口里被显示。 您能也打开变动被保存的ProductList_new.xml文件。 在许多情况下,您won' t想要改变valueyou' ll需要方式插入新的元素或整个部分。 XPathNavigator包括插入的新的元素和属性几个方法在一射击。 然而,容易的方法增加XML块将使用XmlWriter。 如果you' ve与XML一起使用,并且.NET前面,您大概认可XmlWriter。 XmlWriter是常用的写XML内容直接地到文件在.NET 1.x应用。 在.NET 2.0上的区别是XPathEditor允许您使用XmlWriter直接地给您的在记忆XPathDocument写。 您需要做的所有是开始通过叫退回XmlWriter的其中一个XPathEditor方法。 这些包括以下,在不同中的每一安置被插入的XML的地方: AppendChild () 在所有现有的儿童元素以后增加在现行元素里面的一个新的元素。 PrependChild () 在所有现有的儿童元素之前增加在现行元素里面的一个新的元素。 InsertAfter () 在现行元素以后增加一个新的元素(和在同一个水平)。 InsertBefore () 增加在现行元素之前的一个新的元素(和在同一个水平)。 例子5-13使用AppendChild ()方法增加一个新