DOM SAX XML ADO NET GVTH Phm Anh
- Slides: 31
DOM & SAX XML & ADO. NET GVTH: Phạm Anh Phương Email : paphuong@fit. hcmuns. edu. vn
Thời gian 20 minutes
Tham khảo Websites : http: //www. codeproject. com/cs/database/ADONET_and_XML. asp http: //www. w 3. org/XML http: //www. xml. org http: //www. informit. com/guides/content. asp? g=dotnet&seq. Num=80&rl=1 Thư viện MSDN Ebooks : 1/ The. Book. of. SAX-The. Simple. API. for. XML. pdf 2/ MS. Press. Applied. XML. Programming. For. Microsoft. Dot. NET. e. Book. Li. B. chm
Mục lục DOM & SAX XMLDocument XML & ADO. NET
DOM
DOM là gì ? The W 3 C Document Object Model (DOM) is a platform and languageneutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document Interface
DOM là gì ? DOM được chia gồm 3 phần riêng biệt : Core DOM XML DOM HTML DOM Là tập đối tượng thao tác với tài liệu có cấu trúc, XML, HTML
DOM là gì ? << Interface >> DOM XML Parser (. NET, . JAVA, . . ) HTML Parser (IE 6, Firefox, . . ) XXX Parser
XML DOM là gì ? n DOM xem tài liệu XML như 1 cây có cấu trúc n Tất cả Element, Attribute, Text đều có thể truy xuất (thêm, xóa và sửa) n Element, Attribute, Text được xem là Node n Tài liệu XML là 1 Node Tree <? xml version="1. 0" > <name> <first>Phuong</first> <middle>Anh</middle> <last>Pham</last> </name> Name first Phuong middle Anh last Pham
Node Tree n Một cây gồm nhiều node dùng để thể hiện 1 tài liệu XML và sự kết nối giữa chúng - Trong cây, node cao nhất gọi là root - Mỗi node, trừ root ra có chính xác 1 node cha - Một node có nhiều node con - Node lá là node không có node con - Siblings là những node có cùng cấp với node cha
XML DOM Parser n Để đọc, cập nhật, tạo và thao tác 1 tài liệu XML ta cần 1 XML Parser n Có nhiều XML Parser được hỗ trợ trong hầu hết các ngôn ngữ (JAVA, Java. Script, . NET, . . ) n Parser nạp tài liệu XML vào trong bộ nhớ máy tính và được xem dưới dạng cây Node n Sau đó, dữ liệu được thao tác và xử lý thông qua tập hàm XML DOM API
XML DOM Parser
XML DOM API n Duyệt các nodes : - parent. Node child. Nodes first. Child last. Child next. Sibling previous. Sibling Root Element : <bookstore> parent. Node first. Child Element : <book> next. Sibling Element : <book> previous. Sibling Element : <book> last. Child Element : <book>
XML DOM API n Thao tác các Node: - get. Elements. By. Tag. Name - get. Elment. By. Id - get. Named. Item - set. Attribute - get. Attribute - remove. Child - remove. Attribute - replace. Child -. .
SAX
SAX n SAX (Simple API for XML) n Performance và Memory không bị ảnh hưởng cho dù thao tác với tài liệu XML có dung lượng lớn n Event-Driven API
SAX
SAX n Xử lý dữ liệu ngay khi Parser chưa xử lý tòan bộ tài liệu XML (Khác so với DOM) n Dữ liệu sau khi được parse sẽ gửi đến Client Program thông qua các hàm Notification Method; dữ liệu này sau đó bị xóa
SAX n SAX được hỗ trợ trong JAVA nhưng chưa có trong. NET n Khuyết điểm: - - Developer phải tạo cấu trúc lưu trữ thông tin riêng vì dữ liệu gửi về từ parser sẽ tự động mất sau khi đến Notification Method SAX không phù hợp đối với các ứng dụng truy xuất ngẫu nhiên và thực hiện chỉnh sửa phức tạp
XMLDocument
XMLDocument n Là đối tượng dùng để thao tác với tài liệu XML trong. NET n Namespace : System. Xml
XMLDocument Tên hàm (Thuộc tính) Ý nghĩa Load Nạp tài liệu XML Save Ghi tài liệu XML -Insert. Before, Insert. After -Prepend. Child, Append. Child -Remove. Child, Replace. Child, Remove. All Phương thức truy cập node - Node. Changing, Node. Changed -Node. Inserting, Node. Inserted -Node. Removing, Node. Removed Xử lý sự kiện thông qua các delegate -First. Child, Thao tác duyệt node Last. Child -Child. Nodes, Next. Sibling, Previous. Sibling, Parent. Node
XMLDocument n Đọc và lưu n Lấy Root Element :
XMLDocument n. Xóa Node
XMLDocument n. Thêm Node
XML & ADO. NET
XML & ADO. NET n Đối tượng : Data. Set n Ý nghĩa : Một Database nhưng được lưu trong memory n Thao tác : - Tạo mối quan hệ giữa các bảng - Thêm, xóa, sửa các record trong bảng n Với XML : - Ghi dữ liệu thành file XML - Đọc dữ liệu từ file XML và nạp lại vào Data. Set
XML & ADO. NET n Một - số phương thức : Get. Xml. Schema Write. Xml Read. Xml Write. Xml. Schema Read. Xml. Schema
XML & ADO. NET n Minh họa :
- Xml dom sax
- Difference between sax and dom
- Sax prof
- Phm sax
- Sax and dom
- Difference between sax and dom
- Mùa giáng sinh năm xưa anh hẹn anh sẽ về
- 자바 sax xml 파싱
- Ado.net vb.net
- Zenetr
- Domphp
- Xml dom tutorial
- Xml dom
- Xml dom defines a standard way for
- Phm 142
- Sktpm adalah
- Phm hai
- Ado.net ppt
- Ado.net active directory
- What are the ado.net objectives
- Ado.net objects
- Executereader
- Ado.net c
- Ado.net architecture diagram
- Ado object model
- Linq vs ado.net
- Ado.net object model
- Async ado.net
- Ado.net technology
- Ado.net overview
- ¿qué es ado.net?
- Ado real life