SlideShare uma empresa Scribd logo
1 de 56
Introduction to XML Svetlin Nakov Bulgarian Association of Software Developers www.devbg.org
Contents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is XML
What is XML? ,[object Object],[object Object],[object Object],[object Object]
What is XML? (2) ,[object Object],[object Object]
XML - Example <?xml version=&quot;1.0&quot;?> <library name=&quot;.NET Developer's Library&quot;> <book> <title>Programming Microsoft .NET</title> <author>Jeff Prosise</author> <isbn>0-7356-1376-1</isbn> </book> <book> <title>Microsoft .NET for Programmers</title> <author>Fergal Grimes</author> <isbn>1-930110-19-7</isbn> </book> </library>
XML  –  Example <?xml version=&quot;1.0&quot;?> <library  name=&quot;.NET Developer's Library&quot; > <book> <title>Programming Microsoft .NET</title> <author>Jeff Prosise</author> <isbn>0-7356-1376-1</isbn> </book> <book> <title>Microsoft   .NET for Programmers</title> <author>Fergal Grimes</author> <isbn> 1-930110-19-7 </isbn> </book> </library> attribute header part  ( prolog ) element closing tag element value opening tag
XML   and HTML ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Well-Formed Documents ,[object Object],[object Object],[object Object],[object Object],[object Object]
Well-Formed Documents (2) ,[object Object],< xml> <button bug! value=&quot;OK name=&quot;b1&quot;> <animation source=&quot;demo1.avi&quot;>  1 < 2 < 3 </click-button> < / xml >
When to Use   XML? ,[object Object],[object Object],[object Object],[object Object],[object Object]
XML Disadvantages ,[object Object],[object Object],[object Object],[object Object],[object Object]
Namespaces
Namespaces ,[object Object],<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <country:towns xmlns:country=&quot;urn:nakov-com:country&quot; xmlns:town=&quot;http:// www. nakov.com/town&quot;> <town:town> <town:name> Sofia </town:name> <town:population>1 200 000</town:population> <country:name> Bulgaria </country:name> </town:town> <town:town> <town:name>Plovdiv</town:name> <town:population>700 000</town:population> <country:name>Bulgaria</country:name> </town:town> </country:towns>
Namespaces - Example <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <country:towns  xmlns:country=&quot;urn:nakov-com:country&quot; xmlns:town=&quot;http:// www. nakov.com/town&quot;> <town:town> <town:name>Sofia</town:name> <town:population>1 200 000</town:population> <country:name>Bulgaria</country:name> </town:town> <town:town> <town:name>Plovdiv</town:name> <town:population>700 000</town:population> <country:name> Bulgaria </country:name> </town:town> </country:towns> Namespace with prefix  &quot; country &quot;  and  URI  identifier  &quot; urn:nakov-com:country &quot; Tag with name  &quot; name &quot;  from namespace  &quot; country &quot;,  the full name is  &quot; urn:nakov-com:country:name &quot;
Namespaces (2) ,[object Object],<?xml version=&quot;1.0&quot; encoding=&quot;windows-1251&quot;?> <order  xmlns=&quot;http://www.hranitelni-stoki.com/orders&quot; > <item> <name>бира &quot;Загорка&quot;</name> <ammount> 8 </ammount> <measure>бутилка</measure> <price> 3 . 76 </price> </item> <item> <name>кебапчета</name> <ammount>12</ammount> <measure>брой</measure> <price> 4.20 </price> </item> </order>
XML Schemes and Validation
Schemes and Validation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The   DTD Language ,[object Object],[object Object],[object Object],[object Object],[object Object]
The   DTD Language (2) ,[object Object],<!ELEMENT library (book+)> <!ATTLIST library name CDATA #REQUIRED > <!ELEMENT book (title, author, isbn)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT  isbn  (#PCDATA)>
XSD Schemes ,[object Object],[object Object],[object Object],[object Object],[object Object]
XSD Scheme Example <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <xs:schema   xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;> <xs:element name=&quot;library&quot;> <xs:complexType> <xs:sequence> <xs:element ref=&quot;book&quot; maxOccurs=&quot;unbounded&quot;/> </xs:sequence> <xs:attribute name=&quot;name&quot; type=&quot;xs:string&quot;   use=&quot;optional&quot;/> </xs:complexType> </xs:element>   (the example continues)
XSD Scheme Example (2) <xs:element name=&quot;book&quot;> <xs:complexType> <xs:sequence> <xs:element ref=&quot;title&quot;/> <xs:element ref=&quot;author&quot;/> <xs:element ref=&quot;isbn&quot;/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name=&quot;title&quot; type=&quot;xs:string&quot;/> <xs:element name=&quot;author&quot; type=&quot;xs:string&quot;/> <xs:element name=&quot;isbn&quot; type=&quot;xs:string&quot;/> </xs:schema>
XPath
XPath ,[object Object],[object Object],[object Object],[object Object],/library/book[isbn= ' 1-930110-19-7 ' ] /catalog/cd[ @ price < 10.80]
XPath   Expressions ,[object Object],[object Object],[object Object],[object Object],[object Object]
XSL
XSL for Cross - Media Publishing PDF as  digital preprint HTML a s  standard  I nternet  F ormat For Online  P ublishing Author writes in text  processing system using style sheets System saves as/ converts to XML <XML-Document> Catalogue entry MARC-Format Library catalogue XSLT-Stylesheet XSLT-Stylesheet XSLT-Stylesheet
XSL Transformation Language (XSLT)
What is XSLT? ,[object Object],[object Object],[object Object],[object Object]
XSL/XSLT Capabilities  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Browsers Support ,[object Object],[object Object],[object Object],[object Object],[object Object]
Simple XML <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <catalog> <cd> <title> Evergreens </title> <artist></artist> <country>USA</country> <company> USA Music Enterprise </company> <price>1 2 . 0 0</price> <year>198 0 </year>  </cd> . . .  </catalog>  First we have a XML document catalog.xml
Create an XSL Style Sheet <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;> <xsl:template match=&quot;/&quot;> <html> <body> <h2>My CD Collection</h2> <xsl:for-each select=&quot;catalog/cd&quot;> <br/> <xsl:value-of select=&quot;title&quot;/> <xsl:value-of select=&quot;artist&quot;/> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> Then  create an XSL Style Sheet  ( cdc.xsl )
Link the XSL Style Sheet to the XML Document ,[object Object],[object Object],<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <?xml-stylesheet type=&quot;text/xsl&quot;  href=&quot;cdc.xsl&quot;?> <catalog> ... </catalog>
Output Format Control <xsl:stylesheet xmlns:xsl= . . .> <xsl:output method= &quot; html &quot;   encoding= &quot; UTF-8 &quot;  … /> <xsl:template  match = &quot; / &quot; > <HTML>…</HTML> </xsl:template> </xsl:stylesheet> ,[object Object],[object Object],[object Object]
XSLT Specification ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Template Element ,[object Object],[object Object],[object Object],<xsl:template match=&quot;/&quot;>   … </xsl:template>
Import Element ,[object Object],<stylesheet … >   < import  href=&quot;tables.xsl&quot;/>   < import  href=&quot;features.xsl&quot;>   <template … > … </template>   …  </stylesheet>
The <xsl:value-of> Element ,[object Object],Note: The value of the  select  attribute  is an XPath expression  ... <xsl:value-of select=&quot;catalog/cd/title&quot;/> <xsl:value-of select=&quot;catalog/cd/artist&quot;/> ...
The <xsl:for-each> Element ,[object Object],Note: The value of the  select  attribute  is an XPath expression  ... <h2>My CD Collection</h2> <xsl:for-each select=&quot;catalog/cd&quot;> <br/> <xsl:value-of select=&quot;title&quot;/> <xsl:value-of select=&quot;artist&quot;/> </xsl:for-each> </body> ...
The <xsl:for-each> Element  Filter output ,[object Object],<xsl:for-each select=&quot;catalog/cd[artist='Bob  Dylan ']&quot;>  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
XSLT <xsl:sort> Element ,[object Object],[object Object],Note: The  select   attribute indicates what XML element to sort on <h2>My CD Collection</h2> <xsl:for-each select=&quot;catalog/cd&quot;> <xsl:sort select=&quot;artist&quot;/> <br/> <xsl:value-of select=&quot;title&quot;/> <xsl:value-of select=&quot;artist&quot;/> </xsl:for-each> </body>
Sort Element Properties ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<xsl:sort select=&quot; product/price &quot; data-type=&quot;number&quot; order=&quot;descending&quot; />
The <xsl:if> Element ,[object Object],Note:  The value of the required test attribute contains the expression to be evaluated <h2>My CD Collection</h2> <xsl:for-each select=&quot;catalog/cd&quot;> <xsl:if test=&quot;price &gt; 10&quot;>   <br/> <xsl:value-of select=&quot;title&quot;/> <xsl:value-of select=&quot;artist&quot;/> </xsl:if> </xsl:for-each> </body>
The <xsl:choose> Element ,[object Object],[object Object],[object Object],<xsl:choose> <xsl:when test=&quot;XPath  expression &quot;>  ... some output ...  </xsl:when> <xsl:otherwise>   ... some output ....  </xsl:otherwise> </xsl:choose>
The  <xsl:apply-templates>   Element ,[object Object],[object Object],Note:  The value of the required  select  attribute is a XPath expression <xsl:template match=&quot;cd&quot;> <p> <xsl:apply-templates select=&quot;title&quot;/> </p> </xsl:template> <xsl:template  match=&quot;title&quot; >  Title:  <xsl:value-of select=&quot;.&quot;/> <br />  </xsl:template>
Variable Element ,[object Object],[object Object],[object Object],[object Object]
Reusing Templates ,[object Object],//   A named template called by call-template <xsl:template  name=&quot;CreateHeader&quot; >   <html:hr/>   <html:h2>***<xsl:apply-templates/>***</html:h2>   <html:hr/> </xsl:template> ... <xsl:template match=&quot;title&quot;>   < xsl:call-template  name=&quot;CreateHeader&quot; /> </xsl:template> <xsl:template match=&quot;head&quot;>   < xsl:call-template  name=”CreateHeader&quot; /> </xsl:template>
Attribute Values ,[object Object],[object Object],<full-name first=&quot;John&quot; second=&quot;Smith&quot;/> ----------------------------------------- <xsl:template match=&quot;full-name&quot;>   <ajr:person>   <xsl:value-of  select=&quot;@first&quot; >    <xsl:value-of  select=&quot;@second&quot; >   </ajr:person>   <ajr:person name=&quot;{@first} {@second}&quot; /> </xsl:template> ----------------------------------------- <ajr:person>John Smith</ajr:person> <ajr:person name=&quot;John Smith&quot;/>
Creating Elements ,[object Object],[object Object],<xsl:template match= &quot; name &quot; > <xsl:element name= &quot; {.}&quot;>   Nice person!   </xsl:element> </xsl:template> <name>Gosho</name Input <Gosho> Nice person! </Gosho> Result
XSLT Live Demo
Introduction to XML ,[object Object]
Exercises ,[object Object],[object Object],[object Object]
Exercises (2) ,[object Object],[object Object],[object Object],[object Object]
Exercises (3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

Basic xml syntax
Basic xml syntaxBasic xml syntax
Basic xml syntax
Raghu nath
 

Mais procurados (20)

XML
XMLXML
XML
 
XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
XML
XMLXML
XML
 
Xml
XmlXml
Xml
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Basic xml syntax
Basic xml syntaxBasic xml syntax
Basic xml syntax
 
Xml tutorial
Xml tutorialXml tutorial
Xml tutorial
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Intro xml
Intro xmlIntro xml
Intro xml
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
01 Xml Begin
01 Xml Begin01 Xml Begin
01 Xml Begin
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
XML
XMLXML
XML
 
Basic XML
Basic XMLBasic XML
Basic XML
 

Destaque

Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
yht4ever
 
10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
koolkampus
 
eXtensible Markup Language
eXtensible Markup LanguageeXtensible Markup Language
eXtensible Markup Language
Aditya Raj
 
XML.ppt
XML.pptXML.ppt
XML.ppt
butest
 

Destaque (17)

Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
 
Lecture #2 xml
Lecture #2 xmlLecture #2 xml
Lecture #2 xml
 
Xml Publisher And Reporting To Excel
Xml Publisher And Reporting To ExcelXml Publisher And Reporting To Excel
Xml Publisher And Reporting To Excel
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and REST
 
Xs path navigation on xml schemas made easy
Xs path navigation on xml schemas made easy Xs path navigation on xml schemas made easy
Xs path navigation on xml schemas made easy
 
IEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easy
IEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easyIEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easy
IEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easy
 
eXtensible Markup Language
eXtensible Markup LanguageeXtensible Markup Language
eXtensible Markup Language
 
Session 1
Session 1Session 1
Session 1
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
XPath - XML Path Language
XPath - XML Path LanguageXPath - XML Path Language
XPath - XML Path Language
 
XML
XMLXML
XML
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
XML.ppt
XML.pptXML.ppt
XML.ppt
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)
 

Semelhante a Introduction to XML

Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
Jussi Pohjolainen
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
Lorna Mitchell
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
mussawir20
 

Semelhante a Introduction to XML (20)

Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
XMLT
XMLTXMLT
XMLT
 
Intro XML for archivists (2011)
Intro XML for archivists (2011)Intro XML for archivists (2011)
Intro XML for archivists (2011)
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
 
Xml
XmlXml
Xml
 
About XML
About XMLAbout XML
About XML
 
Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Transforming Xml Data Into Html
Transforming Xml Data Into HtmlTransforming Xml Data Into Html
Transforming Xml Data Into Html
 
Introduction To Xml
Introduction To XmlIntroduction To Xml
Introduction To Xml
 
Sax Dom Tutorial
Sax Dom TutorialSax Dom Tutorial
Sax Dom Tutorial
 
3 xml namespaces and xml schema
3   xml namespaces and xml schema3   xml namespaces and xml schema
3 xml namespaces and xml schema
 
Xml
XmlXml
Xml
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
Xml
XmlXml
Xml
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
Digital + Container List
Digital + Container ListDigital + Container List
Digital + Container List
 
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To AskEverything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
 

Mais de BG Java EE Course

Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
BG Java EE Course
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
BG Java EE Course
 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
BG Java EE Course
 

Mais de BG Java EE Course (20)

Rich faces
Rich facesRich faces
Rich faces
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
JSTL
JSTLJSTL
JSTL
 
Unified Expression Language
Unified Expression LanguageUnified Expression Language
Unified Expression Language
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
CSS
CSSCSS
CSS
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Introduction to-RDBMS-systems
Introduction to-RDBMS-systemsIntroduction to-RDBMS-systems
Introduction to-RDBMS-systems
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 
Basic input-output-v.1.1
Basic input-output-v.1.1Basic input-output-v.1.1
Basic input-output-v.1.1
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

Introduction to XML

  • 1. Introduction to XML Svetlin Nakov Bulgarian Association of Software Developers www.devbg.org
  • 2.
  • 4.
  • 5.
  • 6. XML - Example <?xml version=&quot;1.0&quot;?> <library name=&quot;.NET Developer's Library&quot;> <book> <title>Programming Microsoft .NET</title> <author>Jeff Prosise</author> <isbn>0-7356-1376-1</isbn> </book> <book> <title>Microsoft .NET for Programmers</title> <author>Fergal Grimes</author> <isbn>1-930110-19-7</isbn> </book> </library>
  • 7. XML – Example <?xml version=&quot;1.0&quot;?> <library name=&quot;.NET Developer's Library&quot; > <book> <title>Programming Microsoft .NET</title> <author>Jeff Prosise</author> <isbn>0-7356-1376-1</isbn> </book> <book> <title>Microsoft .NET for Programmers</title> <author>Fergal Grimes</author> <isbn> 1-930110-19-7 </isbn> </book> </library> attribute header part ( prolog ) element closing tag element value opening tag
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 14.
  • 15. Namespaces - Example <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <country:towns xmlns:country=&quot;urn:nakov-com:country&quot; xmlns:town=&quot;http:// www. nakov.com/town&quot;> <town:town> <town:name>Sofia</town:name> <town:population>1 200 000</town:population> <country:name>Bulgaria</country:name> </town:town> <town:town> <town:name>Plovdiv</town:name> <town:population>700 000</town:population> <country:name> Bulgaria </country:name> </town:town> </country:towns> Namespace with prefix &quot; country &quot; and URI identifier &quot; urn:nakov-com:country &quot; Tag with name &quot; name &quot; from namespace &quot; country &quot;, the full name is &quot; urn:nakov-com:country:name &quot;
  • 16.
  • 17. XML Schemes and Validation
  • 18.
  • 19.
  • 20.
  • 21.
  • 22. XSD Scheme Example <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;> <xs:element name=&quot;library&quot;> <xs:complexType> <xs:sequence> <xs:element ref=&quot;book&quot; maxOccurs=&quot;unbounded&quot;/> </xs:sequence> <xs:attribute name=&quot;name&quot; type=&quot;xs:string&quot; use=&quot;optional&quot;/> </xs:complexType> </xs:element> (the example continues)
  • 23. XSD Scheme Example (2) <xs:element name=&quot;book&quot;> <xs:complexType> <xs:sequence> <xs:element ref=&quot;title&quot;/> <xs:element ref=&quot;author&quot;/> <xs:element ref=&quot;isbn&quot;/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name=&quot;title&quot; type=&quot;xs:string&quot;/> <xs:element name=&quot;author&quot; type=&quot;xs:string&quot;/> <xs:element name=&quot;isbn&quot; type=&quot;xs:string&quot;/> </xs:schema>
  • 24. XPath
  • 25.
  • 26.
  • 27. XSL
  • 28. XSL for Cross - Media Publishing PDF as digital preprint HTML a s standard I nternet F ormat For Online P ublishing Author writes in text processing system using style sheets System saves as/ converts to XML <XML-Document> Catalogue entry MARC-Format Library catalogue XSLT-Stylesheet XSLT-Stylesheet XSLT-Stylesheet
  • 30.
  • 31.
  • 32.
  • 33. Simple XML <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <catalog> <cd> <title> Evergreens </title> <artist></artist> <country>USA</country> <company> USA Music Enterprise </company> <price>1 2 . 0 0</price> <year>198 0 </year> </cd> . . . </catalog> First we have a XML document catalog.xml
  • 34. Create an XSL Style Sheet <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;> <xsl:template match=&quot;/&quot;> <html> <body> <h2>My CD Collection</h2> <xsl:for-each select=&quot;catalog/cd&quot;> <br/> <xsl:value-of select=&quot;title&quot;/> <xsl:value-of select=&quot;artist&quot;/> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> Then create an XSL Style Sheet ( cdc.xsl )
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 53.
  • 54.
  • 55.
  • 56.

Notas do Editor

  1. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  2. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  3. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  4. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  5. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  6. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  7. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  8. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  9. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  10. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ## XSLT is the most important part of XSL. XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element. With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more. A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree . In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.
  11. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  12. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  13. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  14. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  15. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  16. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ## Output Format Control &lt;xsl:output&gt; has a large number of attributes that control the way the result document is produced, including generation of true HTML rather than XHTML output. For an XML document, this feature allows authors fairly explicit control over the contents of the result document XML declaration, the DOCTYPE declaration, use of CDATA sections, and so on. Specifying html for the method causes the XSLT processor to produce conventional HTML as output text instead of XHTML. Specifying text causes the output to consist only of element text content, concatenated together.
  17. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  18. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  19. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  20. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  21. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  22. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  23. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  24. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  25. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  26. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  27. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  28. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  29. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  30. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  31. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  32. (c) 2007 National Academy for Software Development - http://academy.devbg.org All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##