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 b

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 21:57:31
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 b
xV[SW+ev21qe-㭥 R O[#hjfLd\LÚr.93iv33BJ>i4s믿ws4lj;|ߚ~-M{Ӽ^v֭g_P+ӛ@FI:ݴD%&-!<$,j:4 bќtsP|Ot?H 9􁴹ĢY6D&(I[,+j, !V6IfyQ(q $&5}q 2%W}/Qm=ERYY$eQUQM#|郪ì? G_T> c<@+.eW݋蹐aF >NJ`a`YL * :mPħ@y5'cR!3D:.rnQ.P)53tKDB~ @Jyi B[a3rTzd1-r <$YrEH߆dνiP ٝsI0\ČC7zL 9 MP?cD`+d 쀶@ Fd0t tQPp2 ʘIQsжc:G83T#O, F¢!--dJM#'7 \IRH%w9%դ1 bmm4˲Yf DEP})ǐee!YGyY0H7 7S탟(E@zXy/nD7?wi qO"D 8Pq|uiP?Aa*5avI& F b+)-9s?m=^}5-Zļri$ St]\I#g$=|m^}uM$K rSfYJ h.V_k|*/UtF sr2Fwv(K;ܑ:%5P/7M֑ 5֡|NHL0I:7 )O{,^`Zp~w~_s Vsŭj޻|}ϟ~WxKumY[kz[p[*enc[ Xsm~ȧfƢBZF/]7ig>EqʛV{]) E6"r'W*0F>?6=>@Gߵ^?xyYfFxiB 9Þ]}_Z;ID|i 1.$<-mKF~,[Q*?g#HKNRϸCLa}OIF"G BPmo WI /mB9q[8D~;|}[K/FƆY y2@UgdF@LX`ߝPI/F"A./r[Xw7ϊn?@g]0 ۫8xVQڸp'h$q^K5~V[Ё%iMNB̸74y-w3W哛yeO60c' -/ sqFzW&.k/%RX>z*O&xĭ>ǝ Rw#m^>#^5ŸX_;vz*d eV:|֭.E+D+9ѵJhC?]EDS vZ^ޗ%NAI1kncu#*5a`(l"?QaŁ)ةL8Qd4XߑPŢޗ&?.그_~C4ãv H4MTO|ڻ[S `I]ahzݑ,D"n}/>e|Ex'X~v*)jnC~VH 뇢h]\^S%.`^iZ|`ݳUo&$,bvN5>_X

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 b
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( )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 b
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. 我在哪里可以学会更多?