SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
Introduction to XML

 Course I: Basics about XML
          2003/3/28
Outline
• A first look at XML
• XML Syntax
What is XML?
• Some important facts about XML
   – XML stands for the eXtensible Markup Language
   – It was developed by W3C
       • World Wide Web Consortium
       • www.w3.org
   – XML 1.0 (2nd Edition)
       • W3C recommendation
       • http://www.w3.org/TR/REC-xml
   – XML 1.1
       • Candidate recommendation
Evolution of WWW
    • Web was once a publishing
      tool for scientific documents
      only.
    • Now it is a full-fledged medium,
      like TV or print.
       – Furthermore, Web is an
         Interactive medium
       – Over 800 million Web pages are
         written with HTML
Problems of HTML (I)
• Over the years, HTML has been extended
  – HTML has close to 100 tags
  – Supporting technologies has been introduced by
    vendors
  – Still more tags are needed!
     • Example
         – E-commerce applications need tags for prices, product
           references
         – Streaming would nee tags to control the flow of media
  – HTML is already on the verge of collapsing under its
    own weight!!
Problems of HTML (II)
• Some applications would benefit greatly
  from a reduction in the tag count!
   – More and more people are accessing Web
     from PDA and smart phones
      • Mobile devices are not as powerful as PC
      • The complex Web language cannot be processed
      • The web tags are more than the web content itself
Basic Principles of XML
• Increasing specialized applications need more
  tags, while other applications want a simple
  language
  – W3C resolve this dilemma by making two changes to
    HTML
     • No predefined tags
     • Stricter syntax
No Predefined Tags (I)
 • XML has no predefined tags.
   – The author creates all the tags he needs
       • If u need a certain tag, just make it

HTML   <table>
       <tr>
       <td>Price USD 499 </td>
       <td><a href=”/newsletter”><b>Pineapplesoft Link</b></a></td>
       </tr>
       </table>


  XML     <price currency=“usd”>499.00</price>
          <toc xlink:href=”/newsletter”>Pineapplesoft Link</toc>
No Predefined Tags (II)
• How does the browser know what the author-
  defined tag looks like?
  – Style sheet
• Can we compare different prices?
• What about the current and previous browsers?
• Can we simplify Web site maintenance?
Stricter Syntax
• More than 50% codes in a browser are devoted
  to handle errors or sloppiness on the author’s
  part.
   – Due to increasing using HTML editors
   – Browsers are growing in size and becoming slower
• XML adopt a strict syntax for smaller and faster
  browsers
   <p>Welcome to our site! <img src=logo.jpg>
   <p>Welcome to our site! <img src=”logo.jpg”/></p>
Document Structures (I)
• An example
  INTERNAL MEMO                                            title
  From: Bh Huang
  To: Conrad Ho
  Regarding: Using User Attention Model in
                                                           header
  Watermarking

  Have u finished the job? Can I adopt the program
  directly?I think it will be of great benefits by using
  the user attention model.
                                                           body

  Bh
Document Structures (II)
<?xml version=“1.0”?>
<memo>
<header>
<from>Bh Huang </from>
<to>Conrad Ho</to>
<subject> Using User Attention Model in Watermarking </subject>
</header>

<body>
<para>Have u finished the job? Can I adopt the program directly?I think it will be
great benefits in using the user attention model.</para>
<signature>Bh</signature>
</body>
</memo>
Application of XML
• Most popular applications of XML
  – Document applications manipulate information
    primarily intended for human consumption
  – Data applications manipulate information primarily
    intended for software communications
Document Publishing (I)
• XML concentrates on the structure of the
  document, making it independent of the delivery
  medium




                    HTML
         PDF                     WML
                    XML
                   Document
Document Publishing (II)
• It is possible to edit and maintain documents in
  XML and automatically publish them on different
  media
   – More and more publication are available online and
     in print
   – Web is changing rapidly
   – New markup languages are introduced for specific
     devices
Data Applications
• If the structure of a document can be expressed
  in XML, so as the structure of a database.
• XML web site can be regarded as a large
  database that application can tap
Near-term Applications of XML
• Large web site maintenance
• Exchange information between organizations
• Content made available to different web sites
• E-commerce applications where different
  organizations collaborate to server a customer
• Scientific applications with new markup
  languages for formulas or specifications
• E-books needs to express rights and ownerships
Syntax of XML
<?xml version="1.0"?>
                                                  <!-- Download from www.marchal.com or www.mcp.com -->
                                                  <address-book>

      An Example                                    <entry>
                                                      <name>John Doe</name>
                                                      <address>
                                                        <street>34 Fountain Square Plaza</street>
    John Doe
                                                        <region>OH</region>
    34 Fountain Square Plaza                            <postal-code>45202</postal-code>
    Cincinnati, OH 45202                                <locality>Cincinnati</locality>
    US                                                  <country>US</country>
                                                      </address>
    513-744-8889 (preferred)
                                                      <tel preferred="true">513-744-8889</tel>
    513-744-7098                                      <tel>513-744-7098</tel>
    jdoe@emailaholic.com                              <email href="mailto:john@emailaholic.com"/>
    Jack Smith                                      </entry>
    513-744-3465                                    <entry>
                                                      <name>Jack Smith</name>
    jsmith@emailaholic.com                            <tel>513-744-3465</tel>
    Never leave messages on his                       <email href="mailto:jack@emailaholic.com"/>
    answering machine. Email instead.                 <comments>Never leave messages on his answering
                                                      machine. <b>Email instead.</b></comments>
             Plain text file                        </entry>
                                                  </address-book>
•Which one is easier to read?
•Which one is easier for software to interpret?
                                                                XML Document
Elements
• Fundamental Units of XML
  – E.g. <tel>513-744-7098</tel>
  – Each element is surrounded by a start tag and an
    end tag, which are quite similar to HTML
     • Start tag is the element name contained in the “<“ and “>”
       pair
     • End tag must include an additional “/”
  – Both a start tag and a end tag is required for an
    element
Naming an Element
• The names of elements must follow specific rules.
   – The element name must start with letters or _
   – Other parts of an element name can consist letters, digits, -, .,
     or -.
   – Spaces are not allowed in an element name
   – Element names are case-sensitive

  <copyright-information>   <123>           <address>          address-book
  <p>                       <first name>    <ADDRESS>          AddressBook
  <base64>                  <Tom&jerry>     <Address>
                                                              Suggested writing
  <decompte.client>
  <firstname>                  Illegal     Case sensitivity

          Legal
Attributes
• Additional information of elements
   – <tel preferred=”true”>513-744-8889</tel>
• An attribute is consisting of its attribute name and value.
• Attribute names must follow the same rules as element names
• Start tag of an element can contain more than one or no
  attributes
• Quote marks are required!! (quotes can be ‘ or “)
   – <confidentiality level=“I don’t know”>This document is not confidential
     </confidentiality>
• Attributes are not parts of element names
Special Attributes
• xml:space
  – Specifying the space handling style
     • preserve: preserving all spaces
     • default: neglecting repeated spaces
• xml:lang
  – Specifying content of the element is written in which
    language
     • <p xml:lang=“en-GB”>What colour is it?</p>
     • <p xml:lang=“en-US”>What color is it?</p>
Empty Elements
• Elements having no contents are called empty
  elements
  – <email href=“bhhuang@ms23.hinet.net” />
  – <email href=“bhhuang@ms23.hinet.net”></email>
Hierarchical Structure         <?xml version="1.0"?>
                               <!-- Download from www.marchal.com or www.mcp.com -->
                               <address-book>
of Elements                      <entry>
         Containing texts          <name>John Doe</name>
                                   <address>
                                     <street>34 Fountain Square Plaza</street>
                                     <region>OH</region>
                                     <postal-code>45202</postal-code>
                                     <locality>Cincinnati</locality>
                                     <country>US</country>
                                   </address>
                                   <tel preferred="true">513-744-8889</tel>
                                   <tel>513-744-7098</tel>
                                   <email href="mailto:john@emailaholic.com"/>
                                 </entry>
  Containing other elements      <entry>
                                   <name>Jack Smith</name>
                                   <tel>513-744-3465</tel>
                                   <email href="mailto:jack@emailaholic.com"/>
  Containing mixture of both       <comments>Never leave messages on his answering
                                   machine. <b>Email instead.</b></comments>
                                 </entry>
                               </address-book>
Hierarchical Structure of Elements (cont.)
<entry>                                      Correct   •Elements containing other elements
   <name>Jack Smith</name>                             are called parents
   <tel>513-744-3465</tel>                             •Elements contained in other elements
   <email href="mailto:jack@emailaholic.com"/>
                                                       are called children
   <comments>Never leave messages on his answering
   machine. <b>Email instead.</b></comments>           •Children must be fully contained
 </entry>                                              within their parents


<entry>
   <name>Jack Smith</name>
   <tel>513-744-3465</tel>
   <email href="mailto:jack@emailaholic.com"/>
   <comments>Never leave messages on his answering
   machine. <b>Email instead. </entry> </comments>
</b>
                                           Wrong
The Root Element
   • Each document should have only one root element
           – All other elements must be children of the root element
<?xml version="1.0"?>                     Wrong   <?xml version="1.0"?>                   Correct
<entry>                                           <address-book>
   <name>John Doe</name>                           <entry>
   <email href="mailto:john@emailaholic.com"/>       <name>John Doe</name>
</entry>                                             <email href="mailto:john@emailaholic.com"/>
<entry>                                            </entry>
   <name>Jack Smith</name>                         <entry>
    <email href="mailto:jack@emailaholic.com"/>      <name>Jack Smith</name>
</entry>                                              <email href="mailto:jack@emailaholic.com"/>
                                                   </entry>
                                                  </address-book>
The XML Declaration
•    The first line in an XML document is called the XML declaration
      – <?xml version="1.0"?>
•    As long as a document contains the XML declaration, it means that it is a XML
     document
•    XML version is included in the XML declaration
•    XML declaration is now optional, but is suggested to be included too

    •Current version of XML is 1.0.
    •The second edition is only the first edition with errors corrected.
Comments
• Comments are surrounded by “<!--” and “-->”
• Since comments are read by human users only,
  the XML parsers will neglect them automatically.
   – E.g.   <!-- Download from www.marchal.com or www.mcp.com -->


• Comments cannot be added within an element
   – E.g.   <name <!-- an invalid comment -->>Jack </name>
Unicode
• Unicode support all languages in the world that
  are still being used and mathematical or other
  symbols
• All characters in Unicode are represented by 16
  bits
   – The XML file size will be 2X larger than usual text file
   – Solution: specifying “UTF-8” or “UTF-16” in XML declaration
   – E.g. <?xml version=“1.0” encoding=“ISO-9959-1” ?>
Entity
• Complicated XML documents are usually located
  within several files
• The organizing unit of XML documents is entity
• E.g. if we defined an entity “us” with value
  “United States”
  – <country>&us;</country>
  – <country>United States></country>
Predefined Entities
•   &lt; <
               Entity reference:
•   &amp; &
               <company> Marks & Spencer</company>
•   &gt; ]]>   <company> Marks &amp; Spencer</company>
•   &apos; ‘
•   &quot; “     Character reference:
                <name> Beno&#238;t Marchal</name>
Processing Instruction
• The mechanism to insert non-XML statement
  into an XML document
  – Compromising the structural property of XML
  – Enclosure with “<?” and “>”
  – The first word is called target, to which application or
    device the instruction is directed
     • <?xml version=“1.0” encoding=“ISO-8859-1” ?>
     • <?xml-stylesheet href=“simple-ie5.xsl” type=“text/xsl” ?>
CDATA Sections
• Enclosure with
  “<![CDATA[“ and “]]>”         <? xml version=“1.0”?>
                                <example>
• XML parser will neglect all   <![CDATA[
  escaping symbols              <?xml version=“1.0”?>
                                <entry>
• Used when entity                 <name> John Doe</name>
  references are used too       </entry>]]>
  frequently or another XML     </example>
  document is included
Common Errors
•   The end tag is missing
•   XML is case sensitive
•   Using spaces in element names
•   Quotes of the attribute value is missing

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Introduction to WEB HTML, CSS
Introduction to WEB HTML, CSSIntroduction to WEB HTML, CSS
Introduction to WEB HTML, CSS
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Unit 2 (html)
Unit 2  (html)Unit 2  (html)
Unit 2 (html)
 
Xml
XmlXml
Xml
 
Web programming by Najeeb ullahAzad(1)
Web programming by Najeeb ullahAzad(1)Web programming by Najeeb ullahAzad(1)
Web programming by Najeeb ullahAzad(1)
 
XML DTD Validate
XML DTD ValidateXML DTD Validate
XML DTD Validate
 
HTML By K.Sasidhar
HTML By K.SasidharHTML By K.Sasidhar
HTML By K.Sasidhar
 
Elements of html powerpoint
Elements of html powerpointElements of html powerpoint
Elements of html powerpoint
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Web programming unit IIII XML &DOM NOTES BY BHAVSINGH MALOTH
Web programming unit IIII XML &DOM NOTES BY BHAVSINGH MALOTHWeb programming unit IIII XML &DOM NOTES BY BHAVSINGH MALOTH
Web programming unit IIII XML &DOM NOTES BY BHAVSINGH MALOTH
 
HTML5
HTML5 HTML5
HTML5
 
Web I - 02 - XHTML Introduction
Web I - 02 - XHTML IntroductionWeb I - 02 - XHTML Introduction
Web I - 02 - XHTML Introduction
 
Html css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers workHtml css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers work
 
XML - The Extensible Markup Language
XML - The Extensible Markup LanguageXML - The Extensible Markup Language
XML - The Extensible Markup Language
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Intro to html revised2
Intro to html revised2Intro to html revised2
Intro to html revised2
 
Comp 111chp iv vi
Comp 111chp iv viComp 111chp iv vi
Comp 111chp iv vi
 
Wp unit III
Wp unit IIIWp unit III
Wp unit III
 
Markup Languages
Markup Languages Markup Languages
Markup Languages
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Similar a Introduction to xml

BITM3730Week5.pptx
BITM3730Week5.pptxBITM3730Week5.pptx
BITM3730Week5.pptxMattMarino13
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Reuven Lerner
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Reuven Lerner
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterbrightrocket
 
Ifi7174 lesson1
Ifi7174 lesson1Ifi7174 lesson1
Ifi7174 lesson1Sónia
 
01html Introduction
01html Introduction01html Introduction
01html IntroductionAdil Jafri
 
INFT132 093 04 HTML and XHTML
INFT132 093 04 HTML and XHTMLINFT132 093 04 HTML and XHTML
INFT132 093 04 HTML and XHTMLMichael Rees
 
Wt-UNNIT-1 (1).ppt
Wt-UNNIT-1 (1).pptWt-UNNIT-1 (1).ppt
Wt-UNNIT-1 (1).pptGReshma10
 
Training HTML5 CSS3 Ilkom IPB
Training HTML5 CSS3 Ilkom IPBTraining HTML5 CSS3 Ilkom IPB
Training HTML5 CSS3 Ilkom IPBWahyu Putra
 
WEB TECHNOLOGY:Web Essentials and Markup Language HTML
WEB TECHNOLOGY:Web Essentials and Markup Language HTMLWEB TECHNOLOGY:Web Essentials and Markup Language HTML
WEB TECHNOLOGY:Web Essentials and Markup Language HTMLsmitawagh14
 

Similar a Introduction to xml (20)

BITM3730Week5.pptx
BITM3730Week5.pptxBITM3730Week5.pptx
BITM3730Week5.pptx
 
Html and Xhtml
Html and XhtmlHtml and Xhtml
Html and Xhtml
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniter
 
Xmll
XmllXmll
Xmll
 
xml
xmlxml
xml
 
Ifi7174 lesson1
Ifi7174 lesson1Ifi7174 lesson1
Ifi7174 lesson1
 
01html Introduction
01html Introduction01html Introduction
01html Introduction
 
Unit 01 (1).pdf
Unit 01 (1).pdfUnit 01 (1).pdf
Unit 01 (1).pdf
 
Unit 10
Unit 10Unit 10
Unit 10
 
Xml
XmlXml
Xml
 
HTML - 5 - Introduction
HTML - 5 - IntroductionHTML - 5 - Introduction
HTML - 5 - Introduction
 
23xml
23xml23xml
23xml
 
Thinking restfully
Thinking restfullyThinking restfully
Thinking restfully
 
INFT132 093 04 HTML and XHTML
INFT132 093 04 HTML and XHTMLINFT132 093 04 HTML and XHTML
INFT132 093 04 HTML and XHTML
 
Wt-UNNIT-1 (1).ppt
Wt-UNNIT-1 (1).pptWt-UNNIT-1 (1).ppt
Wt-UNNIT-1 (1).ppt
 
XML.pptx
XML.pptxXML.pptx
XML.pptx
 
Training HTML5 CSS3 Ilkom IPB
Training HTML5 CSS3 Ilkom IPBTraining HTML5 CSS3 Ilkom IPB
Training HTML5 CSS3 Ilkom IPB
 
WEB TECHNOLOGY:Web Essentials and Markup Language HTML
WEB TECHNOLOGY:Web Essentials and Markup Language HTMLWEB TECHNOLOGY:Web Essentials and Markup Language HTML
WEB TECHNOLOGY:Web Essentials and Markup Language HTML
 

Último

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 

Último (20)

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 

Introduction to xml

  • 1. Introduction to XML Course I: Basics about XML 2003/3/28
  • 2. Outline • A first look at XML • XML Syntax
  • 3. What is XML? • Some important facts about XML – XML stands for the eXtensible Markup Language – It was developed by W3C • World Wide Web Consortium • www.w3.org – XML 1.0 (2nd Edition) • W3C recommendation • http://www.w3.org/TR/REC-xml – XML 1.1 • Candidate recommendation
  • 4. Evolution of WWW • Web was once a publishing tool for scientific documents only. • Now it is a full-fledged medium, like TV or print. – Furthermore, Web is an Interactive medium – Over 800 million Web pages are written with HTML
  • 5. Problems of HTML (I) • Over the years, HTML has been extended – HTML has close to 100 tags – Supporting technologies has been introduced by vendors – Still more tags are needed! • Example – E-commerce applications need tags for prices, product references – Streaming would nee tags to control the flow of media – HTML is already on the verge of collapsing under its own weight!!
  • 6. Problems of HTML (II) • Some applications would benefit greatly from a reduction in the tag count! – More and more people are accessing Web from PDA and smart phones • Mobile devices are not as powerful as PC • The complex Web language cannot be processed • The web tags are more than the web content itself
  • 7. Basic Principles of XML • Increasing specialized applications need more tags, while other applications want a simple language – W3C resolve this dilemma by making two changes to HTML • No predefined tags • Stricter syntax
  • 8. No Predefined Tags (I) • XML has no predefined tags. – The author creates all the tags he needs • If u need a certain tag, just make it HTML <table> <tr> <td>Price USD 499 </td> <td><a href=”/newsletter”><b>Pineapplesoft Link</b></a></td> </tr> </table> XML <price currency=“usd”>499.00</price> <toc xlink:href=”/newsletter”>Pineapplesoft Link</toc>
  • 9. No Predefined Tags (II) • How does the browser know what the author- defined tag looks like? – Style sheet • Can we compare different prices? • What about the current and previous browsers? • Can we simplify Web site maintenance?
  • 10. Stricter Syntax • More than 50% codes in a browser are devoted to handle errors or sloppiness on the author’s part. – Due to increasing using HTML editors – Browsers are growing in size and becoming slower • XML adopt a strict syntax for smaller and faster browsers <p>Welcome to our site! <img src=logo.jpg> <p>Welcome to our site! <img src=”logo.jpg”/></p>
  • 11. Document Structures (I) • An example INTERNAL MEMO title From: Bh Huang To: Conrad Ho Regarding: Using User Attention Model in header Watermarking Have u finished the job? Can I adopt the program directly?I think it will be of great benefits by using the user attention model. body Bh
  • 12. Document Structures (II) <?xml version=“1.0”?> <memo> <header> <from>Bh Huang </from> <to>Conrad Ho</to> <subject> Using User Attention Model in Watermarking </subject> </header> <body> <para>Have u finished the job? Can I adopt the program directly?I think it will be great benefits in using the user attention model.</para> <signature>Bh</signature> </body> </memo>
  • 13. Application of XML • Most popular applications of XML – Document applications manipulate information primarily intended for human consumption – Data applications manipulate information primarily intended for software communications
  • 14. Document Publishing (I) • XML concentrates on the structure of the document, making it independent of the delivery medium HTML PDF WML XML Document
  • 15. Document Publishing (II) • It is possible to edit and maintain documents in XML and automatically publish them on different media – More and more publication are available online and in print – Web is changing rapidly – New markup languages are introduced for specific devices
  • 16. Data Applications • If the structure of a document can be expressed in XML, so as the structure of a database. • XML web site can be regarded as a large database that application can tap
  • 17. Near-term Applications of XML • Large web site maintenance • Exchange information between organizations • Content made available to different web sites • E-commerce applications where different organizations collaborate to server a customer • Scientific applications with new markup languages for formulas or specifications • E-books needs to express rights and ownerships
  • 19. <?xml version="1.0"?> <!-- Download from www.marchal.com or www.mcp.com --> <address-book> An Example <entry> <name>John Doe</name> <address> <street>34 Fountain Square Plaza</street> John Doe <region>OH</region> 34 Fountain Square Plaza <postal-code>45202</postal-code> Cincinnati, OH 45202 <locality>Cincinnati</locality> US <country>US</country> </address> 513-744-8889 (preferred) <tel preferred="true">513-744-8889</tel> 513-744-7098 <tel>513-744-7098</tel> jdoe@emailaholic.com <email href="mailto:john@emailaholic.com"/> Jack Smith </entry> 513-744-3465 <entry> <name>Jack Smith</name> jsmith@emailaholic.com <tel>513-744-3465</tel> Never leave messages on his <email href="mailto:jack@emailaholic.com"/> answering machine. Email instead. <comments>Never leave messages on his answering machine. <b>Email instead.</b></comments> Plain text file </entry> </address-book> •Which one is easier to read? •Which one is easier for software to interpret? XML Document
  • 20. Elements • Fundamental Units of XML – E.g. <tel>513-744-7098</tel> – Each element is surrounded by a start tag and an end tag, which are quite similar to HTML • Start tag is the element name contained in the “<“ and “>” pair • End tag must include an additional “/” – Both a start tag and a end tag is required for an element
  • 21. Naming an Element • The names of elements must follow specific rules. – The element name must start with letters or _ – Other parts of an element name can consist letters, digits, -, ., or -. – Spaces are not allowed in an element name – Element names are case-sensitive <copyright-information> <123> <address> address-book <p> <first name> <ADDRESS> AddressBook <base64> <Tom&jerry> <Address> Suggested writing <decompte.client> <firstname> Illegal Case sensitivity Legal
  • 22. Attributes • Additional information of elements – <tel preferred=”true”>513-744-8889</tel> • An attribute is consisting of its attribute name and value. • Attribute names must follow the same rules as element names • Start tag of an element can contain more than one or no attributes • Quote marks are required!! (quotes can be ‘ or “) – <confidentiality level=“I don’t know”>This document is not confidential </confidentiality> • Attributes are not parts of element names
  • 23. Special Attributes • xml:space – Specifying the space handling style • preserve: preserving all spaces • default: neglecting repeated spaces • xml:lang – Specifying content of the element is written in which language • <p xml:lang=“en-GB”>What colour is it?</p> • <p xml:lang=“en-US”>What color is it?</p>
  • 24. Empty Elements • Elements having no contents are called empty elements – <email href=“bhhuang@ms23.hinet.net” /> – <email href=“bhhuang@ms23.hinet.net”></email>
  • 25. Hierarchical Structure <?xml version="1.0"?> <!-- Download from www.marchal.com or www.mcp.com --> <address-book> of Elements <entry> Containing texts <name>John Doe</name> <address> <street>34 Fountain Square Plaza</street> <region>OH</region> <postal-code>45202</postal-code> <locality>Cincinnati</locality> <country>US</country> </address> <tel preferred="true">513-744-8889</tel> <tel>513-744-7098</tel> <email href="mailto:john@emailaholic.com"/> </entry> Containing other elements <entry> <name>Jack Smith</name> <tel>513-744-3465</tel> <email href="mailto:jack@emailaholic.com"/> Containing mixture of both <comments>Never leave messages on his answering machine. <b>Email instead.</b></comments> </entry> </address-book>
  • 26. Hierarchical Structure of Elements (cont.) <entry> Correct •Elements containing other elements <name>Jack Smith</name> are called parents <tel>513-744-3465</tel> •Elements contained in other elements <email href="mailto:jack@emailaholic.com"/> are called children <comments>Never leave messages on his answering machine. <b>Email instead.</b></comments> •Children must be fully contained </entry> within their parents <entry> <name>Jack Smith</name> <tel>513-744-3465</tel> <email href="mailto:jack@emailaholic.com"/> <comments>Never leave messages on his answering machine. <b>Email instead. </entry> </comments> </b> Wrong
  • 27. The Root Element • Each document should have only one root element – All other elements must be children of the root element <?xml version="1.0"?> Wrong <?xml version="1.0"?> Correct <entry> <address-book> <name>John Doe</name> <entry> <email href="mailto:john@emailaholic.com"/> <name>John Doe</name> </entry> <email href="mailto:john@emailaholic.com"/> <entry> </entry> <name>Jack Smith</name> <entry> <email href="mailto:jack@emailaholic.com"/> <name>Jack Smith</name> </entry> <email href="mailto:jack@emailaholic.com"/> </entry> </address-book>
  • 28. The XML Declaration • The first line in an XML document is called the XML declaration – <?xml version="1.0"?> • As long as a document contains the XML declaration, it means that it is a XML document • XML version is included in the XML declaration • XML declaration is now optional, but is suggested to be included too •Current version of XML is 1.0. •The second edition is only the first edition with errors corrected.
  • 29. Comments • Comments are surrounded by “<!--” and “-->” • Since comments are read by human users only, the XML parsers will neglect them automatically. – E.g. <!-- Download from www.marchal.com or www.mcp.com --> • Comments cannot be added within an element – E.g. <name <!-- an invalid comment -->>Jack </name>
  • 30. Unicode • Unicode support all languages in the world that are still being used and mathematical or other symbols • All characters in Unicode are represented by 16 bits – The XML file size will be 2X larger than usual text file – Solution: specifying “UTF-8” or “UTF-16” in XML declaration – E.g. <?xml version=“1.0” encoding=“ISO-9959-1” ?>
  • 31. Entity • Complicated XML documents are usually located within several files • The organizing unit of XML documents is entity • E.g. if we defined an entity “us” with value “United States” – <country>&us;</country> – <country>United States></country>
  • 32. Predefined Entities • &lt; < Entity reference: • &amp; & <company> Marks & Spencer</company> • &gt; ]]> <company> Marks &amp; Spencer</company> • &apos; ‘ • &quot; “ Character reference: <name> Beno&#238;t Marchal</name>
  • 33. Processing Instruction • The mechanism to insert non-XML statement into an XML document – Compromising the structural property of XML – Enclosure with “<?” and “>” – The first word is called target, to which application or device the instruction is directed • <?xml version=“1.0” encoding=“ISO-8859-1” ?> • <?xml-stylesheet href=“simple-ie5.xsl” type=“text/xsl” ?>
  • 34. CDATA Sections • Enclosure with “<![CDATA[“ and “]]>” <? xml version=“1.0”?> <example> • XML parser will neglect all <![CDATA[ escaping symbols <?xml version=“1.0”?> <entry> • Used when entity <name> John Doe</name> references are used too </entry>]]> frequently or another XML </example> document is included
  • 35. Common Errors • The end tag is missing • XML is case sensitive • Using spaces in element names • Quotes of the attribute value is missing