Title: HTML 'htm vs XML 'xml
1HTML (.htm) vs XML (.xml)
- HTML was designed to display data, and to focus
on how data looks. - HTML used a fixed set of tags to tell the browser
how to display data, eg. ltH1gtlt/H1gt, ltBgtlt/Bgt - XML was designed to describe data, and to focus
on what data is.In XML, tags are defined by
user.
2An XML example
3The Anatomy of an XML Document - 1
- The example document consists of two parts the
prolog and the document (root) elements. - The prolog consists of the XML declaration line,
lt?xml version"1.0"?gt, which states this is an
XML document and gives its version number. - A comment line is also included. Note that a
comment begins with the lt!-- comment --gt tag
pairs. - The prolog can also contain other optional
components such as a document type definition,
or processing instructions.
4The Anatomy of an XML Document -2
- The document (root) element, indicate the logical
structure of the document and the documents
information content. - It is similar to the BODY element in an HTML
page, except that you can assign it any legal
name. - In our example, the document(root) element is
INVENTORY, and its content is two nested BOOK
element.
5The Anatomy of an XML Document - 3
- Each BOOK element likewise contains a series of
nested element. - The name that appears at the beginning of the
start-tag and in the end-tag is known as the
element type.
6The Anatomy of an XML Document - 4
- XML Elements have Relationships
- In the previous slide, TITLE, AUHTOR, BINDING,
PAGES, and PRICE are child elements of book. - Book is the parent element of TITLE, AUHTOR,
BINDING, PAGES, and PRICE. - TITLE, AUHTOR, BINDING, PAGES, and PRICE
siblings (or sister elements) because they have
the same parent. -
7What is XML?
- XML stands for EXtensible Markup Language
- XML is a markup language much like HTML
- XML was designed to describe data
- XML tags are not predefined in XML. You must
define your own tags - XML uses a Document Type Definition (DTD) or an
XML Schema to describe the data
8Well-formed XML Document
- A well-formed ( syntactically correct ) XML
document is one that conforms to the minimal set
of rules that allow the processor that allowed
the document to be processed by a browser.
9XML Parser
- An XML parser is a program that can process XML
documents. - The XML parser reads the XML document, checks its
syntax, reports any errors that allows
programmatic access to the documents contents. - Browsers that support XML have a built in parser.
For example, IE 5 has embedded the msxml parser. - If a XML document is not well-formed, an error
message will be displayed.
10Some Basic XML Rules
- The document must have exactly one top-level
element. All other elements must be nested within
it. - Elements must be properly nested.
- Each element must have both a start-tag and an
end-tag - The element-type name in a start-tag must exactly
match the name in the name in the corresponding
end-tag. - Element-type name are case-sensitive.
- With XML, White Space is Preserved
11Element Naming
- XML elements must follow these naming rules
- Names can contain letters, numbers, and other
characters - Names must not start with a number or punctuation
character - Names must not start with the letters xml (or XML
or Xml ..) - Names cannot contain spaces
- It is recommended to make names descriptive.
Names with an underscore separator are nice.
examples ltfirst_namegt, ltlast_namegt. - The characters ,lt.gt,, should not be used.
12Viewing XML Files
- When the XML file does not link to a style sheet,
the browser will simple display the text of the
complete document, including both the mark up,
and the character data. - IE will also colors-code the different document
components to help you identify them. - A plus () or minus sign (-) to the left of the
elements can be clicked to expand or collapse the
element structure. - Do not expect XML files to be formatted like an
HTML document !
13Why does XML display like this?
- XML documents do not carry information about how
to display the data. - XML tags are "invented" by the author of the XML
document. - Browsers do not know how to display the data.
14Displaying XML with Style Sheet
- With CSS (Cascading Style Sheets) you can add
display information to an XML document. - Using our xml_ex1.xml as example, the following
line is added to the prolog - lt?xml-stylesheet type"text/css"
href"Inventory.css"?gt - Another choice to display XML is by XSL(
Extensible Stylesheet Language). - XSL is for more sophisticated than CSS and is the
preferred style sheet language of XML. - One way to use XSL is to transform XML into HTML
before it is displayed by the browser.
15The Inventory.css File
16Xm1-ex1.xml with CSS
17XML Validation
- A "Valid" XML document is a "Well Formed" XML
document, which also conforms to the rules of a
Document Type Definition (DTD) - The purpose of a DTD is to define the legal
building blocks of an XML document. It defines
the document structure with a list of legal
elements - XML schemas are an emerging alternative for
validating XML documents.
18Generating XML with ASP
- To generate an XML response from your server -
simply write the following code and save it as an
ASP file on your web server
19XML Basics
- Elements in XML
- Tags
- Attributes
- Tags
- Enclosed in angle brackets
- e.g.ltTitlegt local service lt/Titlegt
- Attributes
- Convey information
- Text content and Data content
- Two approaches
- ltemployee siteDallasgtmark Nelsonlt/employeegt
- Or
- ltemployeegt
- ltsitegtDallaslt/sitegt
- ltnamegtMark Nelsonlt/namegt
- ltemployeegt
20Data Type Definition Schema
- Known as DTD
- Give developers the ability to strictly define a
given XML vocabulary - Define which tags can be used, where, what type
of contents - lt?xml version1.0?gt
- lt!DOCTYPE nematode- catalog System worm.dtd
- XML schema
- To define the syntax of XML
- Cisco has created a schema for the IP Phone XML
- Example
- ltBookgt
- ltTitlegtThe Data compression Book lt/Titlegt
- ltAuthorgtMark Nelsonlt/Authorgt
- ltISBNgt15585 1434lt/ISBNgt
- lt/Bookgt
21Using XML for IP Phone Service
- XML lets developer create new languages from
marking up documents - Tags is matched and nested
- Attribute is defined
- XML document can only have one top-level object
- You can send XML document that define a single
object - XML as a tool
- XML is simply as a convenient wrapper for object
information - XML objects are generated by backend application
- XML used by Cisco IP Phone service
- A set of tags, attributes, and rules are defined
in its SDK - Cisco IP Phone XML Service language
22Who use XML objects
- objects mean different things to different people
- In Cisco IP phone
- Object entity send from a server to the phone
- Collection of various pieces of text and data
that the phone uses to perform its behavior - JavaScript can help to generate XML that can be
understood by IP Phone - The firmware of IP Phone has a build-in XML
parser - The service output becomes
23XML object display in a IP Phone
- XML object understood by IP Phone
- IP Phone render the XML object and display on the
screen
24XML and IP phones
- XML is a mean (objects) that communicated amongst
clients and servers - XML is just one of type definition
- Others HTML, WML etc
- XML provides the horsepower through IP Phone
object and tags to push contents - Servers able to push most up-to-minute
information to IP Phone - For example weather information, stock
information - IP phone services vs. WAP services
- IP phone service
- XML over HTTP (over IP)
- WAP services
- XML over WAP (over GSM)
25XML object understand by Cisco IP Phone
- CiscoIPPhoneMenu
- CiscoIPPhoneText
- CiscoIPPhoneInput
- CiscoIPPhoneDirectory
- CiscoIPPhoneImage
- CiscoIPPhoneGraphicMenu
- CiscoIPPhoneIconMenu
- CiscoIPPhoneExecute
- CiscoIPPhoneResponse
- CiscoIPPhoneError
26CiscoIPPhoneMenu
- Build a menu in the phone
- Comprises a list of text items
- Use rocker key and press select soft key
ltCiscoIPPhoneMenugt ltTitlegtTitle
Textlt/Titlegt ltPromptgtPrompt Textlt/Promptgt ltMenuIte
mgt ltNamegtName of item 1lt/Namegt
ltURLgthttp//????? lt/URLgt ltNamegtName of
item Nlt/Namegt ltURLgthttp//?????
lt/URLgt lt/MenuItemgt lt/CiscoIPPhoneMenugt
27CiscoIPPhoneMenu
collapse
expand
28CiscoIPPhoneText
- Used to display ordinary 8-bit ASCII text on the
phone display.
ltCiscoIPPhoneTextgt ltTitlegtTitle
Textlt/Titlegt ltPromptgtPrompt Textlt/Promptgt ltTextgtTh
e text to be displaylt/Textgt ltSoftKeyItemgt
ltNamegtName of item 1lt/Namegt ltURLgthttp//?????
lt/URLgt ltPositiongt lt/Positiongt lt/SoftKeyItemgt lt/
CiscoIPPhoneTextgt
29CiscoIPPhoneInput
- It constructs an input form and displays it. The
user then enters data into item and sends the
parameters to the target URL.
ltCiscoIPPhoneInputgt ltTitlegtTitlelt/Titlegt ltPromptgtP
rompt Textlt/Promptgt ltURLgtTarget
URLlt/URLgt ltInputItemgt ltDisplayNamegtName of
input field displaylt/DisplayNamegt
ltQueryStringParamgtParameter target
URLlt/QueryStringParamgt ltDefaultValuegtDefault
display namelt/Default Valuegt ltInputFlagsgtThe
flag specifying the type of inputlt/InputFlagsgt lt/I
nputItemgt ltSoftKeyItemgt ltNamegtName of item
1lt/Namegt ltURLgthttp//????? lt/URLgt
ltPositiongtPosition of the soft Key
lt/Positiongt lt/SoftKeyItemgt lt/CiscoIPPhoneInputgt
30CiscoPhoneDirectory
- The phone uses it to support the directory
operation.
ltCiscoIPPhoneDirectorygt ltDirectoryEntrygt ltNamegtNa
me of Directory Entrylt/Namegt
ltTelephonegtTelephone No. of entrylt/Telephonegt lt/Di
rectoryEntrygt ltSoftKeyItemgt ltNamegtName of item
1lt/Namegt ltURLgthttp//????? lt/URLgt
ltPositiongt lt/Positiongt lt/SoftKeyItemgt lt/CiscoIPPho
neDirectorygt
31CiscoIPPhoneImage
- Provide bit-mapped display with a 133x65 pixel
plane. Each pixel has 4 grayscale (ranged from 0
to 3)
ltCiscoIPPhoneImagegt ltTitlegtTitle
Textlt/Titlegt ltPromptgtlt/Promptgt ltLocationXgtPosition
information of graphiclt/LocationXgt ltLocationYgtPos
ition information of graphiclt/LocationYgt ltWidthgtSi
ze information for graphiclt/Widthgt ltDepthgtNumber
of bits per pixellt/Depthgt ltDatagtPacked Pixel
Datalt/Datagt ltSoftKeyItemgt ltNamegtName of item
1lt/Namegt ltURLgthttp//????? lt/URLgt
ltPositiongt lt/Positiongt lt/SoftKeyItemgt lt/CiscoIPPho
neImagegt
32CiscoIPPhoneGraphicMenu
- Other IP phones objects are similar
- Key feature of object is that they are built on
others - CiscoIPPhoneGraphicMenu
- A menu on the phone comprises a list of text
items, one per line. - CiscoIPPhoneImage CiscoIPPhoneMenu
- The rest can be found in the following reference
book and web sites - Developing Cisco IP Phone Service
- author, D. Deel, M. Nelson, A.Smith Publisher
Cisco Press) - Cisco IP Phone Services Application Development
Notes - http//www.cisco.com/univercd/cc/td/doc/product/vo
ice/sw_ap_to/
33Conclusions
- Advantages of IP Telephony
- IP is an attractive choice for voice
- The widespread availability of IP
- Lower equipment cost compared to circuit switch
- Integrated of voice and data applications
- Successful factors in IP Telephony
- No Delay, Good Voice Quality, Low cost, high
reliability - More importantly, value-added service
- More functional IP phone services