SlideShare a Scribd company logo
1 of 36
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

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)

Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xsltTUSHAR VARSHNEY
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for PerlGeir 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.pptxIreneGetzi
 
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 TechnologyAyes Chinmay
 
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

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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 WorkerThousandEyes
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 

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