tailieunhanh - Use XMLReader to Read an XML Document
Sử dụng XMLReader để hiểu một tài liệu XML Trong thế nào-Để 12,1, tôi đã học được cách để viết ra dữ liệu đến một tài liệu XML bằng cách sử dụng XMLWriter. Làm thế nào để đọc dữ liệu bằng cách sử dụng XMLReader? | Use XMLReader to Read an XML Document In How-To I learned how to write out data to an XML document by using the XMLWriter. How do I read data using the XMLReader Technique Whereas the XMLWriter has one implementation class the XMLReader has three depending on the task you need to perform. Those classes are listed in Table . Table . XMLWriter Implementations Class Name Purpose Descriptions XMLT extReader Reads character streams. This is a forward-only reader that has methods returning data on content and node types. No validation occurs. XMLNode Reader Provides a parser over an XML Document Object Model DOM API similar to the XMLNode tree. XMLValidatingReader Takes an XMLTextReader adding validation. In doing so it provides a fully compliant validating or non-validating XML parser with DTD XSD schema or XML-Data Reduced XDR schema support. For this How-To you will be using the XMLTextReader to read the file and display the results. To do this you will use the following methods Read. Reads a line of the character stream out of the XMLReadReader. AttributeCount. Gives the count of attributes. This depends on the type of data that is being read. In this case AttributeCount is used to display the individual attributes which will be columns. NodeType. Allows you to specify node types in the XML document. In the case of this How-To the is checked for so that no information is printed for that type of node. You can see the other node types by looking at intellisense for the NodeType property. Value. Represents the actual value of the line in the stream. Close. Closes the stream. Steps Open and run the Visual Basic .NET-Chapter 12 solution. From the main Web page click on the hyperlink with the caption How-To Use XMLReader to Read an XML Document. When the page loads click the button labeled Read XML File. The example then reads the XML file that is specified in the text box labeled File to Read and displays the .
đang nạp các trang xem trước