`

101 VB.NET Samples --XML文件的处理

阅读更多

在.Net Frame里的如何处理XML文件的呢.

这要用到System.Xml名字空间.具体的说明要见MSDN.

用到的类有XmlDocumnet,XmlElement,XmlComment,XmlText ,XmlAttribute类

下面是MS例子里的说明:

.NET Framework: Using the XMLDocument Class

This sample shows how to take advantage of the XMLDocument class built-in to System.Xml.dll. This class exposes the XML Document Object Model, or DOM, which can be used to manipulate XML data.

Featured Highlights

In previous versions of Visual Basic, XML processing support for the DOM was provided by the MSXML COM library. The .NET Framework provides a vast array of functionality that equals and oftentimes exceeds those functions found in earlier versions of MSXML. This sample takes a task-based approach to showing how to use the DOM. A checked listbox control lists a set of 'How do I' options. Selecting one will perform the task. You might wish to add breakpoints to examine the code and comments as it runs.

Requirements

Requires the Trial or Release version of Visual Studio .NET Professional (or greater).

Running the Sample

When the sample loads, it checks for the existence of three files:

  • Simple.xml
  • New.xml
  • Bad.xml

If any one of the three does not exist, the main UI will be disabled. The files are located in the \bin folder of the project folder. If the files exist, you will be able to chose a set of commands loaded in to a checked listbox control. Simply highlight an item on the list and then change its check box to selected and the command will be executed. Note some of the commands require saving changes out to disk. Make sure you have read/write permissions to the \bin directory.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics