SlideShare a Scribd company logo
eXtensible Markup Language
                (XML)

Serhii Kartashov
July 2012
SoftServe
IFDC IT Academy
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Origin of XML
                       SGML
                       1986


            HTML 1.0          XML 1.0
              1992             1998


  HTML                                   XHTML
4.01 1999                               1.0 2000


                                         XHTML
                                        2.0 2010
XML Data Model (a tree)
1                       root



2              title    item      item



                        name      name



                       company   company

3
                        model     model



                        cost      cost
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Basic rules
•   All XML Elements Must Have a Closing
•   XML Tags are Case Sensitive
•   XML Elements Must be Properly Nested
•   XML Attribute Values Must be Quoted
•   XML Documents Must Have a Root Element
•   Entity References
•   White-space is Preserved in XML
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Parsing XML
XML parser -- Reads in XML data, checks for
syntactic constraints, and makes data available
to an application. There are three 'generic'
parser APIs
  – SAX Simple API to XML (event-based)
  – DOM Document Object Model (object/tree based)
XML Parser Processing Model


                  parser    XML-based
       parser
                interface   application
DOM APIs
           DocumentBuilder
               Factory                  Packages:
                                         org.w3c.dom
                                         javax.xml.parsers
              Document       Document      (DocumentBuilderFactory,
  XML          Builder        (DOM)        DocumentBuilder) READ
                                         javax.xml.transform
                                           (TransformerFactory, Trans
                                           former, Source, Result)
                                           WRITE
             Transformer
               Factory



Document     Transformer
 (DOM)                           XML
SAX APIs
           Packages:
            org.xml.sax
            org.xml.sax.ext
            org.xml.sax.helpers
            javax.xml.parsers
              (SAXParserFactory, SAXParse
              r)
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Why namespaces?
HTML:
        <table>
                   <tr>
                           <td>Apples</td>
                           <td>Bananas</td>
                   </tr>                                We have the conflict
        </table>                                       between two elements
                                                         (table). And parser
XML:                                                     doesn’t know how
        <table>                                         handle this situation.
                   <name>African Coffee Table</name>
                   <width>80</width>
                   <length>120</length>
        </table>
Namespaces handle conflicts between
         element names.
HTML:
        <h:table xmlns:h="http://www.mysite.org/html>
                <h:tr>
                        <h:td>Apples</h:td>
                        <h:td>Bananas</h:td>   We added name prefix to
                </h:tr>                       each element (table). And
        </h:table>                                 declared they.

XML:
        <x:table xmlns:x="http://www.mysite.org/xml>
                <x:name>African Coffee Table</x:name>
                <x:width>80</x:width>
                <x:length>120</x:length>
        </x:table>
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Defining language dialects
• Two ways of doing so:
   – XML Document Type Declaration (DTD)– Part of core XML
     spec.
   – XML Schema – allows for stronger constraints on XML
     documents.

• Adding dialect specifications implies two classes of
  XML data:
   – Well-formed An XML document that is syntactically
     correct
   – Valid An XML document that is both well-formed and
     consistent with a specific DTD (or Schema)
DTD
<!ELEMENT root (title?, item*)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT item (name, company, model, cost)>
<!ATTRIBUTE id (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT model (#PCDATA)>
<!ELEMENT cost (#PCDATA)>
XML Schema
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name=“root">
 <xs:complexType>
  <xs:sequence>
   <xs:element name=“title" type="xs:string"/>
   <xs:element name=“item“ maxOccurs="unbounded">
    <xs:complexType>
      <xs:sequence>
       <xs:element name=“name" type="xs:string"/>
       <xs:element name=“company" type="xs:string"/>
       <xs:element name="model" type="xs:string"/>
       <xs:element name="cost" type="xs:decimal"/>
      </xs:sequence>
    </xs:complexType>
   </xs:element>
  </xs:sequence>
  <xs:attribute name=“id" type="xs:positiveInteger " use="required"/>
 </xs:complexType>
</xs:element>

</xs:schema>
XML Parser Processing Model With
       Validation Schema


                    parser    XML-based
         parser
                  interface   application



           XML
         Schema
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
XSLT Transformation
XSLT (EXtensible Stylesheet Language
Transformation):
• <template>
• <value-of>
• <for-each>
• <sort>
• <if>
• <choose>
XML file
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="class.xsl"?>
<class>
      <student>Jack</student>
      <student>Harry</student>
      <student>Rebecca</student>
      <teacher>Mr. Bean</teacher>
</class>
XSL file
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

            <xsl:template match="teacher">
                        <p><u><xsl:value-of select="."/></u></p>
            </xsl:template>

            <xsl:template match="student">
                        <p><b><xsl:value-of select="."/></b></p>
            </xsl:template>
            <xsl:template match="/">
                        <html>
                        <body>
                        <xsl:apply-templates/>
                        </body>
                        </html>
            </xsl:template>

</xsl:stylesheet>
XSLT Transformation
Agenda
Introduction to XML

   Basic rules

     Parsing XML

     XML Namespaces

     XML Schemas

   XSLT Transformation

Where is XML applying? (examples)
Web Design and Applications
• XML and CSS (example)
@CHARSET "UTF-8";
title{
            display: block;
            text-align: center;
            font-style: italic;
}
item:after{
            font-size: 250%;
            content: attr(id);
}
item{
            display: block;
            padding:20px;
            border-style: solid;
            font-size: 12px;
}
XML Technology
• XML Transformation
• XML Schema
• XSLT (eXtensible Stylesheet Language
  Transformations)
• MathML (Mathematical Markup Language)
MathML (example)
Web of Services
• HTTP (HyperText Transfer Protocol)
• SOAP (Simple Object Access Protocol)
• WSDL (Web Services Description Language)
Web of Devices
• Mobile Web
• VXML (Voice XML)
Browsers and Authoring Tools
•   Social networks
•   Forums
•   CMSs (Content Management System)
•   RSS (Really Simple Syndication)
Questions
and
Answers
Useful links
• Introduction to XML
   – http://www.itwriting.com/xmlintro.php
   – The development history http://www.w3.org/XML/hist2002
• Basic rules
   – http://www.w3.org/TR/2006/REC-xml11-20060816/
• XML Namespaces
   – http://www.w3.org/TR/REC-xml-names/
• Defining language dialects
   – http://www.w3.org/TR/xhtml1/dtds.html
   – http://www.w3.org/TR/xmlschema-0/
• Parsing XML
   – http://www.w3.org/DOM/DOMTR
• XSLT Transformation
   – http://www.w3.org/TR/xslt
Contacts

• http://it-academy-sk.blogspot.com/




                                       Thank you!

More Related Content

What's hot

Xml 2
Xml  2 Xml  2
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
Bertrand Delacretaz
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
Asfak Mahamud
 
XML - State of the Art
XML - State of the ArtXML - State of the Art
XML - State of the Art
Jakub Malý
 
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
David Ionut
 
Sax parser
Sax parserSax parser
Sax parser
Mahara Jothi
 
Xml parsing
Xml parsingXml parsing
Xml parsing
Malintha Adikari
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New Features
Marco Gralike
 
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
Marco Gralike
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
Andrew Savory
 
XML XSLT
XML XSLTXML XSLT
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2
Marco Gralike
 
XMLT
XMLTXMLT
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
Medhat Dawoud
 

What's hot (20)

Xml 2
Xml  2 Xml  2
Xml 2
 
Xslt tutorial
Xslt tutorialXslt tutorial
Xslt tutorial
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
 
XML - State of the Art
XML - State of the ArtXML - State of the Art
XML - State of the Art
 
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
Sax parser
Sax parserSax parser
Sax parser
 
Xml parsing
Xml parsingXml parsing
Xml parsing
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New Features
 
Xslt
XsltXslt
Xslt
 
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
 
XML XSLT
XML XSLTXML XSLT
XML XSLT
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2
 
XMLT
XMLTXMLT
XMLT
 
Parsing XML Data
Parsing XML DataParsing XML Data
Parsing XML Data
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
 

Similar to eXtensible Markup Language (XML)

XPATH_XSLT-1.pptx
XPATH_XSLT-1.pptxXPATH_XSLT-1.pptx
XPATH_XSLT-1.pptx
BalasundaramSr
 
Xml presentation
Xml presentationXml presentation
Xml presentation
Miguel Angel Teheran Garcia
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
indiangarg
 
Web Information Systems XML
Web Information Systems XMLWeb Information Systems XML
Web Information Systems XML
Artificial Intelligence Institute at UofSC
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
TUSHAR VARSHNEY
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
Dr.Saranya K.G
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for Perl
Geir Aalberg
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1Marco Gralike
 
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
IreneGetzi
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
gauravashq
 
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
Ayes Chinmay
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
Peter Eisentraut
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 

Similar to eXtensible Markup Language (XML) (20)

XPATH_XSLT-1.pptx
XPATH_XSLT-1.pptxXPATH_XSLT-1.pptx
XPATH_XSLT-1.pptx
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
Web Information Systems XML
Web Information Systems XMLWeb Information Systems XML
Web Information Systems XML
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
Xml andweb services
Xml andweb services Xml andweb services
Xml andweb services
 
Xml
XmlXml
Xml
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for Perl
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
 
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
 
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
 
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
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
 
XML
XMLXML
XML
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
Xml
XmlXml
Xml
 
Xml session
Xml sessionXml session
Xml session
 

Recently uploaded

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 

eXtensible Markup Language (XML)

  • 1. eXtensible Markup Language (XML) Serhii Kartashov July 2012 SoftServe IFDC IT Academy
  • 2. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 3. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 4. Origin of XML SGML 1986 HTML 1.0 XML 1.0 1992 1998 HTML XHTML 4.01 1999 1.0 2000 XHTML 2.0 2010
  • 5. XML Data Model (a tree) 1 root 2 title item item name name company company 3 model model cost cost
  • 6. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 7. Basic rules • All XML Elements Must Have a Closing • XML Tags are Case Sensitive • XML Elements Must be Properly Nested • XML Attribute Values Must be Quoted • XML Documents Must Have a Root Element • Entity References • White-space is Preserved in XML
  • 8.
  • 9. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 10. Parsing XML XML parser -- Reads in XML data, checks for syntactic constraints, and makes data available to an application. There are three 'generic' parser APIs – SAX Simple API to XML (event-based) – DOM Document Object Model (object/tree based)
  • 11. XML Parser Processing Model parser XML-based parser interface application
  • 12. DOM APIs DocumentBuilder Factory Packages:  org.w3c.dom  javax.xml.parsers Document Document (DocumentBuilderFactory, XML Builder (DOM) DocumentBuilder) READ  javax.xml.transform (TransformerFactory, Trans former, Source, Result) WRITE Transformer Factory Document Transformer (DOM) XML
  • 13. SAX APIs Packages:  org.xml.sax  org.xml.sax.ext  org.xml.sax.helpers  javax.xml.parsers (SAXParserFactory, SAXParse r)
  • 14. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 15. Why namespaces? HTML: <table> <tr> <td>Apples</td> <td>Bananas</td> </tr> We have the conflict </table> between two elements (table). And parser XML: doesn’t know how <table> handle this situation. <name>African Coffee Table</name> <width>80</width> <length>120</length> </table>
  • 16. Namespaces handle conflicts between element names. HTML: <h:table xmlns:h="http://www.mysite.org/html> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> We added name prefix to </h:tr> each element (table). And </h:table> declared they. XML: <x:table xmlns:x="http://www.mysite.org/xml> <x:name>African Coffee Table</x:name> <x:width>80</x:width> <x:length>120</x:length> </x:table>
  • 17. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 18. Defining language dialects • Two ways of doing so: – XML Document Type Declaration (DTD)– Part of core XML spec. – XML Schema – allows for stronger constraints on XML documents. • Adding dialect specifications implies two classes of XML data: – Well-formed An XML document that is syntactically correct – Valid An XML document that is both well-formed and consistent with a specific DTD (or Schema)
  • 19. DTD <!ELEMENT root (title?, item*)> <!ELEMENT title (#PCDATA)> <!ELEMENT item (name, company, model, cost)> <!ATTRIBUTE id (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT company (#PCDATA)> <!ELEMENT model (#PCDATA)> <!ELEMENT cost (#PCDATA)>
  • 20. XML Schema <?xml version="1.0" encoding="ISO-8859-1" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name=“root"> <xs:complexType> <xs:sequence> <xs:element name=“title" type="xs:string"/> <xs:element name=“item“ maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name=“name" type="xs:string"/> <xs:element name=“company" type="xs:string"/> <xs:element name="model" type="xs:string"/> <xs:element name="cost" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name=“id" type="xs:positiveInteger " use="required"/> </xs:complexType> </xs:element> </xs:schema>
  • 21. XML Parser Processing Model With Validation Schema parser XML-based parser interface application XML Schema
  • 22. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 23. XSLT Transformation XSLT (EXtensible Stylesheet Language Transformation): • <template> • <value-of> • <for-each> • <sort> • <if> • <choose>
  • 24. XML file <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="class.xsl"?> <class> <student>Jack</student> <student>Harry</student> <student>Rebecca</student> <teacher>Mr. Bean</teacher> </class>
  • 25. XSL file <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="teacher"> <p><u><xsl:value-of select="."/></u></p> </xsl:template> <xsl:template match="student"> <p><b><xsl:value-of select="."/></b></p> </xsl:template> <xsl:template match="/"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> </xsl:stylesheet>
  • 27. Agenda Introduction to XML Basic rules Parsing XML XML Namespaces XML Schemas XSLT Transformation Where is XML applying? (examples)
  • 28. Web Design and Applications • XML and CSS (example) @CHARSET "UTF-8"; title{ display: block; text-align: center; font-style: italic; } item:after{ font-size: 250%; content: attr(id); } item{ display: block; padding:20px; border-style: solid; font-size: 12px; }
  • 29. XML Technology • XML Transformation • XML Schema • XSLT (eXtensible Stylesheet Language Transformations) • MathML (Mathematical Markup Language)
  • 31. Web of Services • HTTP (HyperText Transfer Protocol) • SOAP (Simple Object Access Protocol) • WSDL (Web Services Description Language)
  • 32. Web of Devices • Mobile Web • VXML (Voice XML)
  • 33. Browsers and Authoring Tools • Social networks • Forums • CMSs (Content Management System) • RSS (Really Simple Syndication)
  • 35. Useful links • Introduction to XML – http://www.itwriting.com/xmlintro.php – The development history http://www.w3.org/XML/hist2002 • Basic rules – http://www.w3.org/TR/2006/REC-xml11-20060816/ • XML Namespaces – http://www.w3.org/TR/REC-xml-names/ • Defining language dialects – http://www.w3.org/TR/xhtml1/dtds.html – http://www.w3.org/TR/xmlschema-0/ • Parsing XML – http://www.w3.org/DOM/DOMTR • XSLT Transformation – http://www.w3.org/TR/xslt