Session 4
-
Upload
pradeep-sripada -
Category
Technology
-
view
212 -
download
1
Transcript of Session 4
![Page 1: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/1.jpg)
Session 4
Working with XML
![Page 2: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/2.jpg)
Working with XML\ 2 of 29
Session Objectives Work with XML Work with XML using the DOM Discuss the Service Control Manager Create a Windows Service program Create a Service Configuration program
![Page 3: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/3.jpg)
Working with XML\ 3 of 29
Introduction (1) XML forms an integral part of
computing Acts as a universal glue Binds together varied formats of
database to connect and exchange data C# applications can utilize and benefit
from XML
![Page 4: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/4.jpg)
Working with XML\ 4 of 29
Introduction (2) The System.XML namespace handles
XML in .NET XMLReader & XMLWriter classes are
used to read and write XML documents XML Document Object Model
implementation in .NET
![Page 5: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/5.jpg)
Working with XML\ 5 of 29
Introduction (3) Validating XML documents using the
XMLValidatingReader class Creating XML files from an ADO.NET
record set
![Page 6: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/6.jpg)
Working with XML\ 6 of 29
System.XML namespace This namespace contains a number of
classes that help us process XML documents
XMLReader
XMLWriter
XMLTextReader
XMLTextWriter
XMLDocument
![Page 7: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/7.jpg)
Working with XML\ 7 of 29
Writing an XML file (1) Example 1
Contd....
![Page 8: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/8.jpg)
Working with XML\ 8 of 29
Writing an XML file (2)
Contd....
![Page 9: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/9.jpg)
Working with XML\ 9 of 29
Output in an XML file Output -
![Page 10: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/10.jpg)
Working with XML\ 10 of 29
Reading an XML file Example 2 -
![Page 11: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/11.jpg)
Working with XML\ 11 of 29
Reading an XML file Output -
![Page 12: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/12.jpg)
Working with XML\ 12 of 29
Validation Type property The XMLValidatingReader includes a
ValidationType property which is set to the type of validation that needs to be done
![Page 13: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/13.jpg)
Working with XML\ 13 of 29
DTD file for XML Example 3
![Page 14: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/14.jpg)
Working with XML\ 14 of 29
Validating XML data (1) Example 4
Contd....
![Page 15: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/15.jpg)
Working with XML\ 15 of 29
Validating XML data (2) Example 4
Contd…
![Page 16: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/16.jpg)
Working with XML\ 16 of 29
Validating XML data Output -
![Page 17: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/17.jpg)
Working with XML\ 17 of 29
DOM in .NET (1) Example 4 -
![Page 18: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/18.jpg)
Working with XML\ 18 of 29
DOM in .NET (2) Output -
![Page 19: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/19.jpg)
Working with XML\ 19 of 29
Adding data to an XML document (1) Example 5
Contd....
![Page 20: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/20.jpg)
Working with XML\ 20 of 29
Adding data to an XML document (2)
Contd....
![Page 21: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/21.jpg)
Working with XML\ 21 of 29
Contents of Phone.XML Output -
![Page 22: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/22.jpg)
Working with XML\ 22 of 29
Modifying data in an XML document (1) Example 6
Contd....
![Page 23: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/23.jpg)
Working with XML\ 23 of 29
Modifying data in an XML document (2)
Contd…
![Page 24: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/24.jpg)
Working with XML\ 24 of 29
Modifying data in an XML document
Output -
![Page 25: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/25.jpg)
Working with XML\ 25 of 29
Phone.XML modified Output -
![Page 26: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/26.jpg)
Working with XML\ 26 of 29
Writing an ADO.NET dataset to an XML file Example 7 -
![Page 27: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/27.jpg)
Working with XML\ 27 of 29
MyProducts.XML Output -
![Page 28: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/28.jpg)
Working with XML\ 28 of 29
Creating an ADO.NET dataset from an XML file (1) Example 8 -
![Page 29: Session 4](https://reader033.fdocuments.in/reader033/viewer/2022060201/559a2fbf1a28ab86478b45ef/html5/thumbnails/29.jpg)
Working with XML\ 29 of 29
Creating an ADO.NET dataset
from an XML file (2) Output -