作业帮 > 英语 > 作业

vb高手帮忙翻译一段英文

来源:学生作业帮 编辑:神马作文网作业帮 分类:英语作业 时间:2024/11/20 04:59:37
vb高手帮忙翻译一段英文
程序例子就不翻译了
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 XPathNavigator
When you run this application, the XML for the changed document is displayed in the console window. You can also open the ProductList_new.xml file where the changes are saved.
In many cases, you won't just want to change a valueyou'll need a way to insert new elements or entire sections. The XPathNavigator includes a handful of methods for inserting new elements and attributes in one shot. However, the easiest way to add a block of XML is to use an XmlWriter. If you've worked with XML and .NET before, you probably recognize the XmlWriter. The XmlWriter was commonly used to write XML content directly to a file in .NET 1.x applications. The difference in .NET 2.0 is that the XPathEditor allows you to use the XmlWriter to write directly to your in-memory XPathDocument.
All you need to do is start by calling one of the XPathEditor methods that returns an XmlWriter. These include the following, which differ on where each places the inserted XML:
AppendChild( )
Adds a new element inside the current element, after all existing child elements.
PrependChild( )
Adds a new element inside the current element, before any existing child elements.
InsertAfter( )
Adds a new element after the current element (and at the same level).
InsertBefore( )
Adds a new element just before the current element (and at the same level).
Example 5-13 uses the AppendChild() method to add a new product to the product list XML document.
Example 5-13. Using the AppendChild( ) method to add a new element to an XML document
Running Example 5-13 generates the following XML, which is displayed in the console window and saved to the newly generated XML file:
5.11.3. Where can I learn more?
vb高手帮忙翻译一段英文
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 ()方法增加一个新产品到产品名单XML文件. 例子5-13. 使用AppendChild ()方法增加一个新的元素到XML文件 连续例子5-13引起以下XML,在控制台窗口里被显示并且被保存对最近引起的XML文件: 5.11.3. 我在哪里可以学会更多?