xml extensible markup language. what is xml? ● meta-markup language ● a language for defining a...
TRANSCRIPT
![Page 1: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/1.jpg)
XML
Extensible Markup Language
![Page 2: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/2.jpg)
What is XML?
● meta-markup language● a language for defining a family of languages● semantic/structured mark-up language
– defines structure and meaning, NOT formatting or presentation
![Page 3: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/3.jpg)
Why XML?
● supports construction of domain specific markup languages
● creates a common data format● facilitates data interchange● structures large, complex documents
![Page 4: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/4.jpg)
History
● Standard Generalized Markup Language (SGML)– too complex
● Hyper-Text Markup Language (HTML)– not extensible, limited to small set of fixed tags– polluted with non-semantic tags (e.g. <center>, <i>,
and the dreaded <blink>● XML working group formed in 1996● XML is really a slimmed down SGML
![Page 5: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/5.jpg)
XML Applications
● Chemical Markup Language (CML)– originaly a SGML application– used to describe: molecular structures and sequences,
spectrographic analysis, crystallography, chemical databases, and so on
● Mathematical Markup Language (MathML)– adequate for almost all: education, scientific,
engineering, business, economics, and statistics needs– limited for advances math/theoretical physics
![Page 6: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/6.jpg)
MathML example
<apply><power/><apply>
<plus/><ci>a</ci><ci>b</ci>
</apply><cn>2</cn>
</apply>
(a+b)2
![Page 7: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/7.jpg)
XML Document “Goodness”
● well-formed– satisfies the basic rules of XML syntax
● valid– satisifes the domain specific rules for the language as
definded in the Document Type Definintion (DTD)
![Page 8: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/8.jpg)
Well-formed
1.Must start with an XML declaratoin
2.Elements with content must contain matching start and end tags
3.Empty elements must end with />
4.The document must contain exactly one element that contains all other elements
5.Elements may nest but not overlap
![Page 9: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/9.jpg)
XML Declaration
<?xml version=”1.0” standalone=”yes” ?>– standalone – yes if this file contains a complete
document
![Page 10: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/10.jpg)
Tags
● anything that begins with < and ends with >● end tags begin with </● empty tags end with />● tag names
– start with letter or underscore (_)– remianing characters can be letters, numbers, _,
hyphens or periods
![Page 11: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/11.jpg)
Attributes
● start tags can include zero or more attributes● attributes are name/value pairs separated by and
equals sign (=)● the rules for attribute names are the same as for
tag names● the value is any string enclosed in quotes (single
or double)● if the sting contains quotes entity references must
be used: ' or "
![Page 12: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/12.jpg)
Comments
<!-- important message -->● can't be nested or contained inside start/end tags
![Page 13: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/13.jpg)
Entity References
& &
< <
> >
" “
' '
![Page 14: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/14.jpg)
CDATA
● used for content that resembles XML:
<![CDATA[
<?xml version=”1.0” standalone=”yes” ?>
<greeting>
Hello!
</greeting>
]]>
![Page 15: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/15.jpg)
Valid Documents
● body matches Document Type Definition (DTD)
![Page 16: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/16.jpg)
DTDs
<?xml version=”1.0” standalone=”yes” ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>
Hello!
</greeting>
![Page 17: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/17.jpg)
ELEMENTs
● name follwowed pattern● pattern is similar to a regular expression
![Page 18: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/18.jpg)
ATTLIST
● specifies attributes for a tag
<!ATTLIST greeting language CDATA “english”>
![Page 19: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/19.jpg)
Internal Document Type
<!DOCTYPE root_element_name [declarations
]>
<!DOCTYPE greeting [<!ELEMENT greeting (#PCDATA)>
]>
![Page 20: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/20.jpg)
External Document Type (System)
<!DOCTYPE root_element_name SYSTEM DTD_URL>
<!DOCTYPE greetingSYSTEM “http://abc.com/greet.dtd” >
![Page 21: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/21.jpg)
External Document Type (Public)
<!DOCTYPE root_element_name PUBLIC DTD_name DTD_URL>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/ xhtml1/DTD/xhtml1-strict.dtd">
![Page 22: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/22.jpg)
Internal General Entity
<!ENTITY name “replacement text”>
<!ENTITY bk “Brian K. Koehler”><!ENTITY bkc “Copyright 2002, &bk;”>...THE END &bkc;
![Page 23: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/23.jpg)
Internal Parameter Entity
<!ENTITY % name “replacement text”>
<!ENTITY event “(place?, date?)”>...<!ELEMENT ticket (vehicle,%event;)>
![Page 24: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/24.jpg)
ELEMENTs
<!ELEMENT name content_type>
<!ELEMENT document ANY><!ELEMENT street (#PCDATA)><!ELEMENT accident (place,date)><!ELEMENT head (title,meta*)>
![Page 25: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/25.jpg)
ELEMENT content_type
● ANY – anything● #PCDATA – only character data – no contained
elements● EMPTY – element contains no content● reg_exp – a regular expression denoting
acceptable children
![Page 26: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/26.jpg)
Regular expressions
● element_name● re+ 1 or more● re* 0 or more● re? 0 or 1● (re1 | re2 | ... | reN ) re1 or re2 ... or reN● (re1, re2, ..., reN ) re1 followed by re2, ... reN
![Page 27: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/27.jpg)
XHTML head element
● what is the declaration for the XHTML “head” element:– must contain exactly one “title” element– may contain at most one “base” element– may contain 0 or more “meta” elements– title, base, and meta elements can appear in any order
![Page 28: XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language](https://reader030.vdocument.in/reader030/viewer/2022032611/56649e7d5503460f94b80917/html5/thumbnails/28.jpg)
ATTLISTs
<!ATTLIST element_nameattribute_nametype“default value”>
<!ATTLIST img alt CDATA #REQUIRED><!ATTLIST table border CDATA “1”>