SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
KickStart
                            Tutorial
                               XML
                                 version 1.0




free ebooks by spiderpro




Kickstart Tutorial XML               SpiderPro
-2-




General information

The tutorial is available at SpiderPro in the following versions:
  Online HTML http://www.spiderpro.com/bu/buxmlm001.html
 




  PDF http://www.spiderpro.com/ebooks/kickstartxml.pdf
 




  Zipped PDF http://www.spiderpro.com/ebooks/kickstartxml.zip
 




The KickStart Tutorial XML is free. If somebody asked you money for it, you've
been swindled!

You're allowed to distribute this ebook as long as you leave the orginal pdf-file
intact and you don't charge anything for it.



Happy XML-ing


                                                                 Jan Kampherbeek
                                                         Webmaster of SpiderPro
                                                        http://www.spiderpro.com/
                                                               jan@spiderpro.com




Kickstart Tutorial XML                                                    SpiderPro
-3-



This tutorial

               In this tutorial you will learn what XML is about.

               You'll understand the basic XML syntax. An you will know what's
               needed to make XML usable.

               You won't be an XML expert after following this kickstart tutorial. But
               you'll understand the basics of XML. And you'll be able to
               understand XML Documents and most of XML DTD's.




Kickstart Tutorial XML                                                      SpiderPro
-4-



Index
               General information             2
               This Tutorial                   3
               Index                           4
               Why do we needXML ?             5
               What is XML ?                   6
               The general structure of XML    7
               XML Tags                        8
               Elements and sub elements       9
               XML documents                  10
               XML attributes                 12
               Well formed XML documents      13
               Valid XML documents            14
               XML: The DTD                   15
               Presenting XML documents       18
               About SpiderPro                19
               Disclaimer                     19




Kickstart Tutorial XML                             SpiderPro
-5-




Why do we need XML?
Data-exchange
               XML is used to aid the exchange of data. It makes it possible to define
               data in a clear way.
               Both the sending and the receiving party will use XML to understand the
               kind of data that's been sent. By using XML everybody knows that the
               same interpretation of the data is used


Replacement for EDI
               EDI (Electronic Data Interchange) has been for several years the way to
               exchange data between businesses.
               EDI is expensive, it uses a dedicated communication infrastructure.
               And the definitions used are far from flexible.
               XML is a good replacement for EDI. It uses the Internet for the data
               exchange. And it's very flexible.


More possibilities
               XML makes communication easy. It's a great tool for transactions
               between businesses.
               But it has much more possibilities.
               You can define other languages with XML. A good example is WML
               (Wireless Markup Language), the language used in WAP-
               communications.
               WML is just an XML dialect.




Kickstart Tutorial XML                                                        SpiderPro
-6-




What is XML ?

Simpler SGML
XML is a meta-language.
A meta-language is a language that's used to define other languages. You can use
XML for instance to define a language like WML.
XML is a smaller version of SGML. It's easy to master and that's a major advantage
compared to SGML which is a very complex meta-language.



XML: What it can do
With XML you can :

    Define data structures
 




    Make these structures platform independent
 




    Process XML defined data automatically
 




    Define your own tags
 




With XML you cannot

    Define how your data is shown. To show data, you need other techniques.
 




Kickstart Tutorial XML                                                        SpiderPro
-7-




The general structure of XML
Define your own tags
In XML, you define your own tags.
If you need a tag <TUTORIAL> or <STOCKRATE>, that's no problem.



DTD or Schema
If you want to use a tag, you'll have to define it's meaning.
This definition is stored in a DTD (Document Type Definition). You can define your own
DTD or use an existing one.
Defining a DTD actually means defining a XML language.
An alternative for a DTD is Schema.

Showing the results
Often it's not necessary to display the data in a XML document. It's for instance
possible to store the data in a database right away.
If you want to show the data, you can. XML itself is not capable of doing so.
But XML documents can be made visible with the aid of a language that defines the
presentation.
XSL (eXtensible Stylesheet Language) is created for this purpose. But the presentation
can also be defined with CSS (Cascading Style Sheets).




Kickstart Tutorial XML                                                       SpiderPro
-8-




XML Tags
Tags
XML tags are created like HTML tags. There's a start tag and a closing tag.
<TAG>content</TAG>
The closing tag uses a slash after the opening bracket, just like in HTML.
The text between the brackets is called an element.



Syntax
The following rules are used for using XML tags:
  Tags are case sensitive. The tag <TRAVEL> differs from the tags <Travel> and
 




  <travel>
  Starting tags always need a closing tag
 




  All tags must be nested properly
 




  Comments can be used like in HTML: <!-- Comments -->
 




  Between the starting tag and the end tag XML expects the content.
 




  <amount>135</amount> is a valid tag for an element amount that has the content
  135



Empty tags
Besides a starting tag and a closing tag, you can use an empty tag. An empty tag does
not have a closing tag.
The syntax differs from HTML:      <TAG/>




Kickstart Tutorial XML                                                        SpiderPro
-9-




Elements and sub elements
Elements and children
With XML tags you define the type of data. But often data is more complex. It can
consist of several parts.
To describe the element car you can define the tags <car>mercedes</car>. This model
might look like this:

<car>
<brand>volvo</brand>
<type>v40</type>
<color>green</color>
</car>


Besides the element car three other elements are used: brand, type and color.
Brand, type and color are sub-elements of the element car. In the XML-code the tags of
the sub-elements are enclosed within the tags of the element car. Sub-elements are
also called children




Kickstart Tutorial XML                                                      SpiderPro
-10-




XML documents
The XML declaration
The first line of an XML document is the XML declaration.
It's a special kind of tag:
 <?xml version=quot;1.0quot;?>

The version 1.0 is the actual version of XML.
The XML declaration makes clear that we're talking XML and also which version is
used.
The version identification will become important after new versions of XML are used.

The root element
All XML documents must have a root element.
All other elements in the same document are children of this root element. The root
element is the top level of the structure in an XML document.



Structure of an XML page
<?xml version=quot;1.0quot;?>
<root>
        <element>
              <sub-element>
                     content
              </sub-element>
              <sub-element>
                     content
              </sub-element>
        element>
</root>
All elements must be nested. The level of nesting can be arbitrarily deep.




Kickstart Tutorial XML                                                        SpiderPro
-11-

A real XML page

<?xml version=quot;1.0quot;?>
<sales>
       <shop>
              <number>
                      100
              </number>
              <manager>
                      Ray Bradbury
              </manager>
       </shop>
       <product>
              <name>
                      carrots
              </name>
              <totalprice>
                      10
              </totalprice>
       </product>
</sales>




Kickstart Tutorial XML               SpiderPro
-12-




XML Attributes
Attributes
Elements in XML can use attributes. The syntax is:
<element attribute-name = quot;attribute-valuequot;>....</element>

The value of an attribute needs to be quoted, even if it contains only numbers.
An example
<car color = quot;greenquot;>volvo</car>

The same information can also be defined without using attributes:
<car>
       <brand>volvo</brand>
       <color>green</color>
</car>



Avoid attributes
When possible try to avoid attributes. Data structures are more easy described in XML-
tags.
Software that checks XML-documents can do a better job with tags than with attributes.




Kickstart Tutorial XML                                                            SpiderPro
-13-


Well formed XML documents
Well formedness
An XML document needs to be well formed. Well formed means that the document
applies to the syntax rules for XML.



The rules
To be well formed a document needs to comply to the following rules:
  it contains a root element
 




  all other elements are children of the root element
 




  all elements are correctly paired
 




  the element name in a start-tag and an end-tag are exactly the same
 




  attribute names are used only once within the same element
 




Note
There are more rules, some of them have to do with entities. In this quick tutorial,
entities are not covered.




Kickstart Tutorial XML                                                           SpiderPro
-14-


Valid XML documents
Valid
To be of practical use, an XML document needs to be valid. To be valid an XML
document needs to apply to the following rules:
  The document must be well formed. (More on well formed in the previous page).
 




  The document must apply to the rules as defined in a Document Type Definition
 




  (DTD), (More on DTD's in the next page)

If a document is valid, it's clearly defined what the data in the document really means.

There's no possibility to use a tag that's not defined in the DTD. Companies that
exchange XML-documents can check them with the same DTD.
Because a valid XML document is also well formed, there's no possibility for typo's in
the tags.



Valid is about structure
A valid XML-document has a structure that's valid. That's the part you can check.
There's no check for the content.




Kickstart Tutorial XML                                                          SpiderPro
-15-




XML: the DTD
Defining the language
To use XML you need a DTD (Document Type Definition).
A DTD contains the rules for a particular type of XML-documents.
Actually it's the DD that defines the language.



Elements
A DTD describes elements. It uses the following syntax:
The text <! ELEMENT, followed by the name of the element, followed by a description
of the element.
For instance:
<!ELEMENT brand (#PCDATA)>
This DTD description defines the XML tag <brand>.



Data
The description (#PCDATA) stands for parsed character data.
It's the tag that is shown and also will be parsed (interpreted) by the program that reads
the XML document.
You can also define (#CDATA), this stands for character data.
CDATA will not be parsed or shown.



Sub elements
An element that contains sub elements is described thus:
<!ELEMENT car (brand, type) >
<!ELEMENT brand (#PCDATA) >
<!ELEMENT type (#PCDATA) >

                                                                                      -16-

This means that the element car has two subtypes: brand and type. Each subtype can
contain characters.

Kickstart Tutorial XML                                                          SpiderPro
Number of sub elements
If you use <!ELEMENT car (brand, type) >, the sub elements brand and type can
occur once inside the element car. To change the number of possible occurrences the
following indications can be used:

    + must occur at least one time but may occur more often
 




    * may occur more often but may also be omitted
 




    ? may occur once or not at all
 




The indications are used behind the sub element name. For instance:
<!ELEMENT animal (color+) >



Making choices
With the sign '|' you define a choice between two sub elements.
You enter the sign between the names of the sub elements.
<!ELEMENT animal (wingsize|legsize) >



Empty elements
Empty elements get the description EMPTY.
For instance
<!ELEMENT separator EMPTY>
that could define a separator line to be shown if the XML document appears in a
browser.



DTD: external
A DTD can be an external document that's referred to.
Such a DTD starts with the text
<!DOCTYPE name of root-element SYSTEM quot;addressquot;>
The address is an URL that points to the DTD.
                                                                                  -17-

In the XML document you make clear that you'll use this DTD with the line:
<!DOCTYPE name of root-element SYSTEM quot;addressquot;>
that should be typed after the line <?xml version=quot;1.0quot;?>




Kickstart Tutorial XML                                                       SpiderPro
DTD: internal
A DTD can also be included in the XML document itself.
After the line <?xml version=quot;1.0quot;?> you must type
<!DOCTYPE name of root-element [
followed by the element definitions.
The DTD part is closed with
]>




Kickstart Tutorial XML                                   SpiderPro
-18-




Presenting XML documents
Showing XML documents
XML is about defining data. With XML you can define documents that are understood
by computers.
But to make these documents understandable to humans, you need to show them.



CSS
Cascading Style sheets (CSS offer possibilities to show XML.
It works just like adding styles to HTML elements.

XSL
The preferred solution is using XSL (eXtensible Style sheet Language).
XSL can convert XML documents into HTML.
It can be used client side but the best solution is to use XSL server side. You can
convert your XML documents to HTML, thus making them visible to any browser.




Kickstart Tutorial XML                                                          SpiderPro
-19-



                                             address to anyone and we will never
About                                        sell your address.
                                             You can subscribe at:

SpiderPro                                    http://www.spiderpro.com/ab/abmlist.html




                                             Disclaimer
This eBook is published by SpiderPro.
SpiderPro is a website that presents
information for professional                 The autor of this ebook is dutch, the use
webmasters.                                  of english surely won't be perfect. If you
Well, with professional I don't want to      find a more or less annoying mistake I'll
frighten anyone. If you just want to build   be glad to receive a mail at:
a nice personal homepage you'll find         corr@spiderpro.com
lots of info at SpiderPro.
But you'll also find info that you can use
only if you have access to a webserver.               Jan Kampherbeek, May 5, 2001
Or if you know how to write programs.
With SpiderPro I hope to reach people
that are strongly involved with web
development. Maybe for a living, maybe
just for the hack of it...

The URL of SpiderPro is
http://www.spiderpro.com/



Mailing List
SpiderPro's mailing list informs you
when new information becomes
available. Subscription is free.
If you subscribe, you'll receive mails
about updates to SpiderPro and about
new released ebooks.
Expect to receive this mails about 2
times a month.
SpiderPro will use your email address
for the sole purpose of sending you
mails from the list.
We will never use your address for any
other purpose. We will never give your




Kickstart Tutorial XML                                                           SpiderPro

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
XML
XMLXML
XML
 
XML
XMLXML
XML
 
Xmlphp
XmlphpXmlphp
Xmlphp
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
SQL Server - Querying and Managing XML Data
SQL Server - Querying and Managing XML DataSQL Server - Querying and Managing XML Data
SQL Server - Querying and Managing XML Data
 
Fergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XML
Fergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XMLFergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XML
Fergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XML
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
XML and DTD
XML and DTDXML and DTD
XML and DTD
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
About XML
About XMLAbout XML
About XML
 
XML | Computer Science
XML | Computer ScienceXML | Computer Science
XML | Computer Science
 
Sgml
SgmlSgml
Sgml
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)
 
4 xml namespaces and xml schema
4   xml namespaces and xml schema4   xml namespaces and xml schema
4 xml namespaces and xml schema
 
XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 

Destacado

Mikro
MikroMikro
Mikrosepp6
 
Modern day curing revised july 2006
Modern day curing revised july 2006Modern day curing revised july 2006
Modern day curing revised july 2006curing1958
 
Esitlus Struve meridiaan
Esitlus Struve meridiaanEsitlus Struve meridiaan
Esitlus Struve meridiaanevitar
 
CMMi NDIA Conference_Jabali
CMMi NDIA Conference_JabaliCMMi NDIA Conference_Jabali
CMMi NDIA Conference_Jabalitjabali
 
Communist party line fbi file series in 25 parts - vol. (20)
Communist party line   fbi file series in 25 parts - vol. (20)Communist party line   fbi file series in 25 parts - vol. (20)
Communist party line fbi file series in 25 parts - vol. (20)RareBooksnRecords
 

Destacado (6)

Mikro
MikroMikro
Mikro
 
Modern day curing revised july 2006
Modern day curing revised july 2006Modern day curing revised july 2006
Modern day curing revised july 2006
 
Los números
Los númerosLos números
Los números
 
Esitlus Struve meridiaan
Esitlus Struve meridiaanEsitlus Struve meridiaan
Esitlus Struve meridiaan
 
CMMi NDIA Conference_Jabali
CMMi NDIA Conference_JabaliCMMi NDIA Conference_Jabali
CMMi NDIA Conference_Jabali
 
Communist party line fbi file series in 25 parts - vol. (20)
Communist party line   fbi file series in 25 parts - vol. (20)Communist party line   fbi file series in 25 parts - vol. (20)
Communist party line fbi file series in 25 parts - vol. (20)
 

Similar a Kickstart Tutorial Xml (20)

Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Module 5 XML Notes.pdf
Module 5 XML Notes.pdfModule 5 XML Notes.pdf
Module 5 XML Notes.pdf
 
Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01
 
Xml material
Xml materialXml material
Xml material
 
Xml material
Xml materialXml material
Xml material
 
Xml material
Xml materialXml material
Xml material
 
Xml description
Xml descriptionXml description
Xml description
 
93 peter butterfield
93 peter butterfield93 peter butterfield
93 peter butterfield
 
HTML AND XML ppt.pptx
HTML AND XML ppt.pptxHTML AND XML ppt.pptx
HTML AND XML ppt.pptx
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
 
Tutor Xml Gxs
Tutor Xml GxsTutor Xml Gxs
Tutor Xml Gxs
 
Xml overview
Xml overviewXml overview
Xml overview
 
Lecture 5 XML
Lecture 5  XMLLecture 5  XML
Lecture 5 XML
 
LECT_TWO.pptx
LECT_TWO.pptxLECT_TWO.pptx
LECT_TWO.pptx
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 
paper about xml
paper about xmlpaper about xml
paper about xml
 
00 introduction
00 introduction00 introduction
00 introduction
 
XML Bible
XML BibleXML Bible
XML Bible
 
Web Services Part 1
Web Services Part 1Web Services Part 1
Web Services Part 1
 
01 Xml Begin
01 Xml Begin01 Xml Begin
01 Xml Begin
 

Más de LiquidHub

Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0LiquidHub
 
Sharepoint 2013 upgrade process
Sharepoint 2013 upgrade processSharepoint 2013 upgrade process
Sharepoint 2013 upgrade processLiquidHub
 
Share point 2013
Share point 2013Share point 2013
Share point 2013LiquidHub
 
Share point 2010-uiimprovements
Share point 2010-uiimprovementsShare point 2010-uiimprovements
Share point 2010-uiimprovementsLiquidHub
 
Microsoft office-sharepoint-server-2007-presentation-120211522467022-2
Microsoft office-sharepoint-server-2007-presentation-120211522467022-2Microsoft office-sharepoint-server-2007-presentation-120211522467022-2
Microsoft office-sharepoint-server-2007-presentation-120211522467022-2LiquidHub
 
Managing metadata in_share_point_2010
Managing metadata in_share_point_2010Managing metadata in_share_point_2010
Managing metadata in_share_point_2010LiquidHub
 
Fast search for share point
Fast search for share pointFast search for share point
Fast search for share pointLiquidHub
 
Simple Farm Server Deployment
Simple Farm Server DeploymentSimple Farm Server Deployment
Simple Farm Server DeploymentLiquidHub
 
Pre Install Databases
Pre Install DatabasesPre Install Databases
Pre Install DatabasesLiquidHub
 
Moss 2007 Deployment Detail
Moss 2007 Deployment DetailMoss 2007 Deployment Detail
Moss 2007 Deployment DetailLiquidHub
 
Moss 2007 Backup Strategies
Moss 2007 Backup StrategiesMoss 2007 Backup Strategies
Moss 2007 Backup StrategiesLiquidHub
 
How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003
How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003
How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003LiquidHub
 
5060 A 01 Demonstration Steps
5060 A 01 Demonstration Steps5060 A 01 Demonstration Steps
5060 A 01 Demonstration StepsLiquidHub
 
Working With Infopath 2007
Working With Infopath 2007Working With Infopath 2007
Working With Infopath 2007LiquidHub
 
Whats New In Microsoft Windows Share Point Services Feature Walkthrough
Whats New In Microsoft Windows Share Point Services Feature WalkthroughWhats New In Microsoft Windows Share Point Services Feature Walkthrough
Whats New In Microsoft Windows Share Point Services Feature WalkthroughLiquidHub
 
Overviewofthe2007 Microsoft Office System Components Refresh
Overviewofthe2007 Microsoft Office System Components RefreshOverviewofthe2007 Microsoft Office System Components Refresh
Overviewofthe2007 Microsoft Office System Components RefreshLiquidHub
 
Organizingand Finding Resourceswith Office Share Point Server2007 Refresh
Organizingand Finding Resourceswith Office Share Point Server2007 RefreshOrganizingand Finding Resourceswith Office Share Point Server2007 Refresh
Organizingand Finding Resourceswith Office Share Point Server2007 RefreshLiquidHub
 

Más de LiquidHub (20)

Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0Share point 2013 coding standards and best practices 1.0
Share point 2013 coding standards and best practices 1.0
 
Sharepoint 2013 upgrade process
Sharepoint 2013 upgrade processSharepoint 2013 upgrade process
Sharepoint 2013 upgrade process
 
Share point 2013
Share point 2013Share point 2013
Share point 2013
 
Share point 2010-uiimprovements
Share point 2010-uiimprovementsShare point 2010-uiimprovements
Share point 2010-uiimprovements
 
Microsoft office-sharepoint-server-2007-presentation-120211522467022-2
Microsoft office-sharepoint-server-2007-presentation-120211522467022-2Microsoft office-sharepoint-server-2007-presentation-120211522467022-2
Microsoft office-sharepoint-server-2007-presentation-120211522467022-2
 
Managing metadata in_share_point_2010
Managing metadata in_share_point_2010Managing metadata in_share_point_2010
Managing metadata in_share_point_2010
 
Fast search for share point
Fast search for share pointFast search for share point
Fast search for share point
 
Simple Farm Server Deployment
Simple Farm Server DeploymentSimple Farm Server Deployment
Simple Farm Server Deployment
 
Pre Install Databases
Pre Install DatabasesPre Install Databases
Pre Install Databases
 
Moss 2007 Deployment Detail
Moss 2007 Deployment DetailMoss 2007 Deployment Detail
Moss 2007 Deployment Detail
 
Moss 2007 Backup Strategies
Moss 2007 Backup StrategiesMoss 2007 Backup Strategies
Moss 2007 Backup Strategies
 
How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003
How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003
How To Configure Email Enabled Lists In Moss2007 Rtm Using Exchange 2003
 
Bdc Screens
Bdc ScreensBdc Screens
Bdc Screens
 
Bdc Screens
Bdc ScreensBdc Screens
Bdc Screens
 
5060 A 01 Demonstration Steps
5060 A 01 Demonstration Steps5060 A 01 Demonstration Steps
5060 A 01 Demonstration Steps
 
5060 A 01
5060 A 015060 A 01
5060 A 01
 
Working With Infopath 2007
Working With Infopath 2007Working With Infopath 2007
Working With Infopath 2007
 
Whats New In Microsoft Windows Share Point Services Feature Walkthrough
Whats New In Microsoft Windows Share Point Services Feature WalkthroughWhats New In Microsoft Windows Share Point Services Feature Walkthrough
Whats New In Microsoft Windows Share Point Services Feature Walkthrough
 
Overviewofthe2007 Microsoft Office System Components Refresh
Overviewofthe2007 Microsoft Office System Components RefreshOverviewofthe2007 Microsoft Office System Components Refresh
Overviewofthe2007 Microsoft Office System Components Refresh
 
Organizingand Finding Resourceswith Office Share Point Server2007 Refresh
Organizingand Finding Resourceswith Office Share Point Server2007 RefreshOrganizingand Finding Resourceswith Office Share Point Server2007 Refresh
Organizingand Finding Resourceswith Office Share Point Server2007 Refresh
 

Último

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
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
 
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
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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
 

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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...
 

Kickstart Tutorial Xml

  • 1. KickStart Tutorial XML version 1.0 free ebooks by spiderpro Kickstart Tutorial XML SpiderPro
  • 2. -2- General information The tutorial is available at SpiderPro in the following versions: Online HTML http://www.spiderpro.com/bu/buxmlm001.html   PDF http://www.spiderpro.com/ebooks/kickstartxml.pdf   Zipped PDF http://www.spiderpro.com/ebooks/kickstartxml.zip   The KickStart Tutorial XML is free. If somebody asked you money for it, you've been swindled! You're allowed to distribute this ebook as long as you leave the orginal pdf-file intact and you don't charge anything for it. Happy XML-ing Jan Kampherbeek Webmaster of SpiderPro http://www.spiderpro.com/ jan@spiderpro.com Kickstart Tutorial XML SpiderPro
  • 3. -3- This tutorial In this tutorial you will learn what XML is about. You'll understand the basic XML syntax. An you will know what's needed to make XML usable. You won't be an XML expert after following this kickstart tutorial. But you'll understand the basics of XML. And you'll be able to understand XML Documents and most of XML DTD's. Kickstart Tutorial XML SpiderPro
  • 4. -4- Index General information 2 This Tutorial 3 Index 4 Why do we needXML ? 5 What is XML ? 6 The general structure of XML 7 XML Tags 8 Elements and sub elements 9 XML documents 10 XML attributes 12 Well formed XML documents 13 Valid XML documents 14 XML: The DTD 15 Presenting XML documents 18 About SpiderPro 19 Disclaimer 19 Kickstart Tutorial XML SpiderPro
  • 5. -5- Why do we need XML? Data-exchange XML is used to aid the exchange of data. It makes it possible to define data in a clear way. Both the sending and the receiving party will use XML to understand the kind of data that's been sent. By using XML everybody knows that the same interpretation of the data is used Replacement for EDI EDI (Electronic Data Interchange) has been for several years the way to exchange data between businesses. EDI is expensive, it uses a dedicated communication infrastructure. And the definitions used are far from flexible. XML is a good replacement for EDI. It uses the Internet for the data exchange. And it's very flexible. More possibilities XML makes communication easy. It's a great tool for transactions between businesses. But it has much more possibilities. You can define other languages with XML. A good example is WML (Wireless Markup Language), the language used in WAP- communications. WML is just an XML dialect. Kickstart Tutorial XML SpiderPro
  • 6. -6- What is XML ? Simpler SGML XML is a meta-language. A meta-language is a language that's used to define other languages. You can use XML for instance to define a language like WML. XML is a smaller version of SGML. It's easy to master and that's a major advantage compared to SGML which is a very complex meta-language. XML: What it can do With XML you can : Define data structures   Make these structures platform independent   Process XML defined data automatically   Define your own tags   With XML you cannot Define how your data is shown. To show data, you need other techniques.   Kickstart Tutorial XML SpiderPro
  • 7. -7- The general structure of XML Define your own tags In XML, you define your own tags. If you need a tag <TUTORIAL> or <STOCKRATE>, that's no problem. DTD or Schema If you want to use a tag, you'll have to define it's meaning. This definition is stored in a DTD (Document Type Definition). You can define your own DTD or use an existing one. Defining a DTD actually means defining a XML language. An alternative for a DTD is Schema. Showing the results Often it's not necessary to display the data in a XML document. It's for instance possible to store the data in a database right away. If you want to show the data, you can. XML itself is not capable of doing so. But XML documents can be made visible with the aid of a language that defines the presentation. XSL (eXtensible Stylesheet Language) is created for this purpose. But the presentation can also be defined with CSS (Cascading Style Sheets). Kickstart Tutorial XML SpiderPro
  • 8. -8- XML Tags Tags XML tags are created like HTML tags. There's a start tag and a closing tag. <TAG>content</TAG> The closing tag uses a slash after the opening bracket, just like in HTML. The text between the brackets is called an element. Syntax The following rules are used for using XML tags: Tags are case sensitive. The tag <TRAVEL> differs from the tags <Travel> and   <travel> Starting tags always need a closing tag   All tags must be nested properly   Comments can be used like in HTML: <!-- Comments -->   Between the starting tag and the end tag XML expects the content.   <amount>135</amount> is a valid tag for an element amount that has the content 135 Empty tags Besides a starting tag and a closing tag, you can use an empty tag. An empty tag does not have a closing tag. The syntax differs from HTML: <TAG/> Kickstart Tutorial XML SpiderPro
  • 9. -9- Elements and sub elements Elements and children With XML tags you define the type of data. But often data is more complex. It can consist of several parts. To describe the element car you can define the tags <car>mercedes</car>. This model might look like this: <car> <brand>volvo</brand> <type>v40</type> <color>green</color> </car> Besides the element car three other elements are used: brand, type and color. Brand, type and color are sub-elements of the element car. In the XML-code the tags of the sub-elements are enclosed within the tags of the element car. Sub-elements are also called children Kickstart Tutorial XML SpiderPro
  • 10. -10- XML documents The XML declaration The first line of an XML document is the XML declaration. It's a special kind of tag: <?xml version=quot;1.0quot;?> The version 1.0 is the actual version of XML. The XML declaration makes clear that we're talking XML and also which version is used. The version identification will become important after new versions of XML are used. The root element All XML documents must have a root element. All other elements in the same document are children of this root element. The root element is the top level of the structure in an XML document. Structure of an XML page <?xml version=quot;1.0quot;?> <root> <element> <sub-element> content </sub-element> <sub-element> content </sub-element> element> </root> All elements must be nested. The level of nesting can be arbitrarily deep. Kickstart Tutorial XML SpiderPro
  • 11. -11- A real XML page <?xml version=quot;1.0quot;?> <sales> <shop> <number> 100 </number> <manager> Ray Bradbury </manager> </shop> <product> <name> carrots </name> <totalprice> 10 </totalprice> </product> </sales> Kickstart Tutorial XML SpiderPro
  • 12. -12- XML Attributes Attributes Elements in XML can use attributes. The syntax is: <element attribute-name = quot;attribute-valuequot;>....</element> The value of an attribute needs to be quoted, even if it contains only numbers. An example <car color = quot;greenquot;>volvo</car> The same information can also be defined without using attributes: <car> <brand>volvo</brand> <color>green</color> </car> Avoid attributes When possible try to avoid attributes. Data structures are more easy described in XML- tags. Software that checks XML-documents can do a better job with tags than with attributes. Kickstart Tutorial XML SpiderPro
  • 13. -13- Well formed XML documents Well formedness An XML document needs to be well formed. Well formed means that the document applies to the syntax rules for XML. The rules To be well formed a document needs to comply to the following rules: it contains a root element   all other elements are children of the root element   all elements are correctly paired   the element name in a start-tag and an end-tag are exactly the same   attribute names are used only once within the same element   Note There are more rules, some of them have to do with entities. In this quick tutorial, entities are not covered. Kickstart Tutorial XML SpiderPro
  • 14. -14- Valid XML documents Valid To be of practical use, an XML document needs to be valid. To be valid an XML document needs to apply to the following rules: The document must be well formed. (More on well formed in the previous page).   The document must apply to the rules as defined in a Document Type Definition   (DTD), (More on DTD's in the next page) If a document is valid, it's clearly defined what the data in the document really means. There's no possibility to use a tag that's not defined in the DTD. Companies that exchange XML-documents can check them with the same DTD. Because a valid XML document is also well formed, there's no possibility for typo's in the tags. Valid is about structure A valid XML-document has a structure that's valid. That's the part you can check. There's no check for the content. Kickstart Tutorial XML SpiderPro
  • 15. -15- XML: the DTD Defining the language To use XML you need a DTD (Document Type Definition). A DTD contains the rules for a particular type of XML-documents. Actually it's the DD that defines the language. Elements A DTD describes elements. It uses the following syntax: The text <! ELEMENT, followed by the name of the element, followed by a description of the element. For instance: <!ELEMENT brand (#PCDATA)> This DTD description defines the XML tag <brand>. Data The description (#PCDATA) stands for parsed character data. It's the tag that is shown and also will be parsed (interpreted) by the program that reads the XML document. You can also define (#CDATA), this stands for character data. CDATA will not be parsed or shown. Sub elements An element that contains sub elements is described thus: <!ELEMENT car (brand, type) > <!ELEMENT brand (#PCDATA) > <!ELEMENT type (#PCDATA) > -16- This means that the element car has two subtypes: brand and type. Each subtype can contain characters. Kickstart Tutorial XML SpiderPro
  • 16. Number of sub elements If you use <!ELEMENT car (brand, type) >, the sub elements brand and type can occur once inside the element car. To change the number of possible occurrences the following indications can be used: + must occur at least one time but may occur more often   * may occur more often but may also be omitted   ? may occur once or not at all   The indications are used behind the sub element name. For instance: <!ELEMENT animal (color+) > Making choices With the sign '|' you define a choice between two sub elements. You enter the sign between the names of the sub elements. <!ELEMENT animal (wingsize|legsize) > Empty elements Empty elements get the description EMPTY. For instance <!ELEMENT separator EMPTY> that could define a separator line to be shown if the XML document appears in a browser. DTD: external A DTD can be an external document that's referred to. Such a DTD starts with the text <!DOCTYPE name of root-element SYSTEM quot;addressquot;> The address is an URL that points to the DTD. -17- In the XML document you make clear that you'll use this DTD with the line: <!DOCTYPE name of root-element SYSTEM quot;addressquot;> that should be typed after the line <?xml version=quot;1.0quot;?> Kickstart Tutorial XML SpiderPro
  • 17. DTD: internal A DTD can also be included in the XML document itself. After the line <?xml version=quot;1.0quot;?> you must type <!DOCTYPE name of root-element [ followed by the element definitions. The DTD part is closed with ]> Kickstart Tutorial XML SpiderPro
  • 18. -18- Presenting XML documents Showing XML documents XML is about defining data. With XML you can define documents that are understood by computers. But to make these documents understandable to humans, you need to show them. CSS Cascading Style sheets (CSS offer possibilities to show XML. It works just like adding styles to HTML elements. XSL The preferred solution is using XSL (eXtensible Style sheet Language). XSL can convert XML documents into HTML. It can be used client side but the best solution is to use XSL server side. You can convert your XML documents to HTML, thus making them visible to any browser. Kickstart Tutorial XML SpiderPro
  • 19. -19- address to anyone and we will never About sell your address. You can subscribe at: SpiderPro http://www.spiderpro.com/ab/abmlist.html Disclaimer This eBook is published by SpiderPro. SpiderPro is a website that presents information for professional The autor of this ebook is dutch, the use webmasters. of english surely won't be perfect. If you Well, with professional I don't want to find a more or less annoying mistake I'll frighten anyone. If you just want to build be glad to receive a mail at: a nice personal homepage you'll find corr@spiderpro.com lots of info at SpiderPro. But you'll also find info that you can use only if you have access to a webserver. Jan Kampherbeek, May 5, 2001 Or if you know how to write programs. With SpiderPro I hope to reach people that are strongly involved with web development. Maybe for a living, maybe just for the hack of it... The URL of SpiderPro is http://www.spiderpro.com/ Mailing List SpiderPro's mailing list informs you when new information becomes available. Subscription is free. If you subscribe, you'll receive mails about updates to SpiderPro and about new released ebooks. Expect to receive this mails about 2 times a month. SpiderPro will use your email address for the sole purpose of sending you mails from the list. We will never use your address for any other purpose. We will never give your Kickstart Tutorial XML SpiderPro