SlideShare a Scribd company logo
1 of 25
Module 12: Reading and Writing XML Data
Overview ,[object Object],[object Object],[object Object],[object Object]
Lesson:  Overview of XML Architecture in ASP.NET ,[object Object],[object Object]
What is XML? <?xml version=&quot;1.0&quot;?>  <authors> <author ID=&quot;1&quot;> <name>Jay</name> </author> <!-- There are more authors. --> </authors> ,[object Object],[object Object],[object Object],[object Object],Processing Instruction Elements Attributes Comments
XML Core Technologies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Lesson: XML and the DataSet Object ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why Use XML with Datasets? ,[object Object],[object Object],[object Object],[object Object],Human Readable Mainframe Readable XML File Or Stream Browser Readable Web Server DataSet Firewall
Overview of XML and Datasets XML File DataSet Object XmlDataDocument Object XslTransform Object XML or  HTML File Database DataAdapter ReadXML Doc.Save WriteXML XSLT File XML File XML File
[object Object],[object Object],[object Object],The XML-Based Methods of the DataSet Object DataSet ds = new DataSet(); ds.ReadXml(Server.MapPath(&quot;filename.xml&quot;));   DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(&quot;select * from Authors&quot;, conn); da.Fill(ds); ds.WriteXml(Server.MapPath(&quot;filename.xml&quot;));  string strXmlDS = ds.GetXml();   Visual Basic .NET Code Example
Demonstration:  Reading and Writing XML to and from a DataSet ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Practice: Using the ReadXml Method ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],Creating Nested XML Data Dim dr As New DataRelation _ (&quot;name&quot;, parentCol,  childCol) dr.Nested = True ds.Relations.Add(dr) <Title name=&quot;title1&quot; /> <Title name=&quot;title2&quot; /> <Title name=&quot;title3&quot; /> <Publisher name=&quot;pub1&quot; /> <Publisher name=&quot;pub2&quot; /> <Publisher name=&quot;pub1&quot; > <Title name=&quot;title1&quot; /> <Title name=&quot;title3&quot; /> </Publisher> <Publisher name=&quot;pub2&quot; > <Title name=&quot;title2&quot; /> </Publisher> DataRelation dr = new DataRelation(&quot;name&quot;, parentCol,  childCol); dr.Nested = true; ds.Relations.Add(dr);
Demonstration:  Creating Nested XML ,[object Object],[object Object],[object Object],[object Object]
Lesson: Working with XML Data ,[object Object],[object Object],[object Object],[object Object],[object Object]
Overview of Synchronizing a DataSet with an XmlDataDocument Database DataAdapter DataSet Tables XmlDataDocument XML Transformations Other XML Document Types XML Document Navigation Synchronized System.Data System.Xml
[object Object],[object Object],How to Synchronize a DataSet with an XmlDataDocument Dim ds As New DataSet() 'fill in ds Dim objXmlDataDoc As New XmlDataDocument(ds) XmlDataDocument objXmlDataDoc = new XmlDataDocument(); objXmlDataDoc.Load(Server.MapPath (&quot;file.xml&quot;)); -or- objXmlDataDoc.DataSet.ReadXml(Server.MapPath (&quot;file.xml&quot;)); DataSet ds = new DataSet(); //fill in ds objXmlDataDoc = new XmlDataDocument(ds); Dim objXmlDataDoc As New XmlDataDocument() objXmlDataDoc.Load(Server.MapPath (&quot;file.xml&quot;)) -or- objXmlDataDoc.DataSet.ReadXml(Server.MapPath (&quot;file.xml&quot;))
Working with an XmlDataDocument ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],dg.DataSource = objXmlDataDoc.DataSet Dim elem As XmlElement elem = objXmlDataDoc.GetElementFromRow _ (ds.Tables(0).Rows(1)) XmlElement elem; elem = objXmlDataDoc.GetElementFromRow(ds.Tables[0].Rows[1]);  dg.DataSource = objXmlDataDoc.DataSet;
Transforming XML Data with XSLT ,[object Object],[object Object],Dim ds As New DataSet() 'fill in DataSet ... Dim xmlDoc As New XmlDataDocument(ds) Dim xslTran As New XslTransform() xslTran.Load(Server.MapPath(&quot;PubTitles.xsl&quot;)) Dim writer As New XmlTextWriter _ (Server.MapPath(&quot;PubTitles_output.html&quot;), _ System.Text.Encoding.UTF8) xslTran.Transform(xmlDoc, Nothing, writer) writer.Close() C# Code Example
Demonstration:  Transforming Data with XSLT ,[object Object],[object Object],[object Object]
Lesson: Using the XML Web Server Control ,[object Object],[object Object],[object Object]
What is the XML Web Server Control? ,[object Object],[object Object],<asp:Xml id=&quot; Xml1 &quot;  Document=&quot; XmlDocument object to display &quot; DocumentContent=&quot; String of XML &quot;  DocumentSource=&quot; Path to XML Document &quot;  Transform=&quot; XslTransform object &quot;  TransformSource=&quot; Path to XSL Document &quot;  runat=&quot;server&quot;/>
Loading and Saving XML Data ,[object Object],[object Object],[object Object],xmlCtl.Document.Save(Server.MapPath(&quot;text.xml&quot;))   xmlCtl.Document.Load(Server.MapPath(&quot;text.xml&quot;))  <asp:Xml id=&quot;xmlCtl&quot; runat=&quot;server&quot; />  xmlCtl.Document.Save(Server.MapPath(&quot;text.xml&quot;)) ; xmlCtl.Document.Load(Server.MapPath(&quot;text.xml&quot;));
Demonstration: Using the XML Web Server Control ,[object Object],[object Object],[object Object],[object Object],[object Object]
Review ,[object Object],[object Object],[object Object],[object Object]
Lab 12: Reading XML Data Medical Medical.aspx Benefits Home Page Default.aspx Life Insurance Life.aspx Retirement Retirement.aspx Dental Dental.aspx Dentists Doctors Doctors.aspx  Doctors Logon Page Login.aspx Registration Register.aspx Coho Winery Prospectus Prospectus.aspx XML Web  Service dentalService1.asmx  Page Header Header.ascx ASPState tempdb Lab Web Application User Control namedate.ascx Menu  Component Class1.vb or Class1.cs XML Files Web. config

More Related Content

What's hot

What's hot (20)

Ajax
AjaxAjax
Ajax
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
 
Ajax Technology
Ajax TechnologyAjax Technology
Ajax Technology
 
Ajax
AjaxAjax
Ajax
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
 
AJAX
AJAXAJAX
AJAX
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax Ppt
Ajax PptAjax Ppt
Ajax Ppt
 
Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
 
What is Ajax technology?
What is Ajax technology?What is Ajax technology?
What is Ajax technology?
 
Database connectivity in asp.net
Database connectivity in asp.netDatabase connectivity in asp.net
Database connectivity in asp.net
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
ASP.NET- database connectivity
ASP.NET- database connectivityASP.NET- database connectivity
ASP.NET- database connectivity
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
Ajax.pdf
Ajax.pdfAjax.pdf
Ajax.pdf
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
AJAX
AJAXAJAX
AJAX
 
Web II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET WorksWeb II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET Works
 
Ajax
AjaxAjax
Ajax
 

Similar to 2310 b 12

IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
Ted Leung
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
mussawir20
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Marco Gralike
 

Similar to 2310 b 12 (20)

Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
 
6 311 W
6 311 W6 311 W
6 311 W
 
6 311 W
6 311 W6 311 W
6 311 W
 
test
testtest
test
 
SimpleXML In PHP 5
SimpleXML In PHP 5SimpleXML In PHP 5
SimpleXML In PHP 5
 
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web TechnologyInternet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology
 
Dxl As A Lotus Domino Integration Tool
Dxl As A Lotus Domino Integration ToolDxl As A Lotus Domino Integration Tool
Dxl As A Lotus Domino Integration Tool
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
 
Xml
XmlXml
Xml
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
 
Sax Dom Tutorial
Sax Dom TutorialSax Dom Tutorial
Sax Dom Tutorial
 
Javascript2839
Javascript2839Javascript2839
Javascript2839
 
Json
JsonJson
Json
 
XML Databases
XML DatabasesXML Databases
XML Databases
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Import web resources using R Studio
Import web resources using R StudioImport web resources using R Studio
Import web resources using R Studio
 
Xml
XmlXml
Xml
 

More from Krazy Koder (20)

2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xc
2310 b xc2310 b xc
2310 b xc
 
2310 b xb
2310 b xb2310 b xb
2310 b xb
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 14
2310 b 142310 b 14
2310 b 14
 
2310 b 10
2310 b 102310 b 10
2310 b 10
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 05
2310 b 052310 b 05
2310 b 05
 
2310 b 04
2310 b 042310 b 04
2310 b 04
 
2310 b 03
2310 b 032310 b 03
2310 b 03
 
2310 b 02
2310 b 022310 b 02
2310 b 02
 
2310 b 01
2310 b 012310 b 01
2310 b 01
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

2310 b 12

  • 1. Module 12: Reading and Writing XML Data
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. Overview of XML and Datasets XML File DataSet Object XmlDataDocument Object XslTransform Object XML or HTML File Database DataAdapter ReadXML Doc.Save WriteXML XSLT File XML File XML File
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Overview of Synchronizing a DataSet with an XmlDataDocument Database DataAdapter DataSet Tables XmlDataDocument XML Transformations Other XML Document Types XML Document Navigation Synchronized System.Data System.Xml
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. Lab 12: Reading XML Data Medical Medical.aspx Benefits Home Page Default.aspx Life Insurance Life.aspx Retirement Retirement.aspx Dental Dental.aspx Dentists Doctors Doctors.aspx Doctors Logon Page Login.aspx Registration Register.aspx Coho Winery Prospectus Prospectus.aspx XML Web Service dentalService1.asmx Page Header Header.ascx ASPState tempdb Lab Web Application User Control namedate.ascx Menu Component Class1.vb or Class1.cs XML Files Web. config