... button1_Click (object sender, System.EventArgs e) { //use a filestream to get the data FileStream fs = new FileStream(" \\ \\ \\books.xml",FileMode.Open); XmlTextReader tr = new XmlTextReader(fs); ... dụng FileStreams, bạn cần phải bảo đảm include không gian tên System.IO câu lệnh using protected void button1_Click (object sender, System.EventArgs e) { //use a filestream to get the data FileStream ... đối tượng string chứa tên đường dẫn file XML Sau tạo XmlTextReader với chuỗi truyền fileName XmlTextReader có mười ba tải Chúng ta kết hợp chuỗi truyền khác (filenames URLs), streams NameTables...
... sơ đồ không gian tên XDR (XM- Data Reduced) vào file books.xml chúng ta, đổi tên file thành booksVal.xml Nó trông này: file represents a fragment of a book store ... tw.WriteEndDocument(); //clean up tw.Flush(); tw.Close(); } Ở viết file XML gọi booknew.xml, thêm liệu cho sách Nhớ XmlTextWriter ghi đè file lên file cũ Chúng ta xem xét thành thành phần, nút tài liệu ... WriteAttributeString(), có vài phương thức ghi đặc biệc WriteCData() xuất đoạn CData (), việc xuât text cần tham số WriteComment() xuất ghi theo định dạng XML WriteChars() xuất ghi chi của chuỗi...