SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Kürzlich hochgeladen (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

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