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

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

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