lecture 2 overview n.
Skip this Video
Download Presentation
Lecture 2 Overview

Loading in 2 Seconds...

play fullscreen
1 / 28

Lecture 2 Overview - PowerPoint PPT Presentation

  • Uploaded on

Lecture 2 Overview. Web Services concept XML introduction Visual Studio .net. HTML Primer. HTML is HyperTex Markup Language HTML is a “specialization” of SGML HTML is a language for describing how web pages should look. HTML has some constructions for

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Lecture 2 Overview' - lesley

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lecture 2 overview
Lecture 2 Overview
  • Web Services concept
  • XML introduction
  • Visual Studio .net

HTML Primer

HTML is HyperTex Markup Language

HTML is a “specialization” of SGML

HTML is a language for describing how web pages

should look. HTML has some constructions for

forms, frames, etc that make it a bit more dynamic.

HTML is very simple....we’re going to go over

only the basics...other sources:

- read the source of other pages

- web HTML manuals and how-to’s

basic syntax of an html
Basic syntax of an HTML
  • HTML uses “tags”
  • tags typically have a beginning and a closing version.
  • example....every html page should start with the tag
    • <html>

and end with

    • </html>

Not essential but good style.

basic structure of an html page
Basic structure of an HTML page




Our first page!!




Blah, blah, blah



why web services
Why Web Services?
  • HTML describes the formatting of a web page
  • Originally designed to let people read web pages easily via that formatting
  • The structure of the page is not necessarily conveyed by HTML
  • The meaning of a page is certainly not in the HTML
  • If programs are to consume information on web pages, then HTML is not enough
what are web services
What are Web Services?
  • A language to define web resources’ structure/syntax - XML
  • A transport protocol for moving XML - SOAP
  • A language to describe a service – WSDL
  • Directory-like services to locate XML described services - UDDI
example of xml
Example of XML



<name>Mocha Java</name>     








xml overview
XML Overview
  • XML vs HTML
    • HTML is a presentation markup language
    • XML is a content markup language
    • both are derivatives of SGML
    • “elements”, “attributes”, “values” and content
    • syntax is more strict in XML than in HTML
    • large development activity underway
    • version 1.0
  • DARPA Agent Markup Language (DAML)
  • Genome information
  • XML registries
  • MathML

Created with a text editor and saved in file.xml

<?xml version="1.0"?>


<name format=“FNLN”>Jane Smith</name>


<phone>(212) 555-4567</phone>



<name format=“FNLN”>Jane Smith</name>

element attribute value content

Elements can be nested interspersed with “text”


<name format=“FNLN”>Jane Smith</name>works

at <company>AT&amp;T</company>.


xml declaration
XML Declaration

All XML documents can optionally begin with an XML declaration.

The XML declaration provides at a minimum the number of the

version of XML in use:

<?xml version="1.0"?>

Currently, 1.0 is the only approved version of XML, but others

may appear in the future.

The XML declaration can also specify the character encoding

used in the document:

<?xml version="1.0" encoding="UTF-8"?>


All XML parsers: Unicode “UTF-8” and “UTF-16” encodings.

the XML declaration is case sensitive: it may not begin with

“<?XML” or any other variant;

if the XML declaration appears at all, it must be the very first

thing in the XML document: not even whitespace or comments

may appear before it; and

it is legal for a transfer protocol like HTTP to override the encoding

value that you put in the XML declaration, so you cannot guarantee

that the document will actually use the encoding provided in the

XML declaration.


“elements” are the logical units of information

in an XML document.

An element consists of a start tag, optional text or

other complete elements,

followed by an end tag.

<p><person>Tony Blair</person> is


Minister</function> of <location>



parsing this example
Parsing this example...

the p element, that contains the entire example

(the person element, the text “ is ”, the function

element, the text “ of ”, and the location element);

the person element, that contains the text “Tony Blair”;

the function element, that contains the text “Prime Minister”;

the location element, that contains the country element; and

the country element, that contains the text “Great Britain”.

syntax errors
Syntax errors

<!-- WRONG! -->



Tags must be nested properly. eg...

<!-- RIGHT-->

<person><function>President</function> Habibe</person>


An XML document must have only one “root” element.

<!-- WRONG! -->



The following example fixes the problem by including both

the a and b elements within a new x root element:






<!-- WRONG! -->

<a href="pbear.html">polar bear</A>

This example will cause a parser error because an XML processor considers a and A to be separate elements, so the start and end tags do not match. Case sensitive!!!

XML has a special empty-element tag that represents both the start tag and the end tag:


More stuff.</p>

In this example, “<hr/>” represents both the start and the end of the hr element; equivalent to “<hr></hr>”


In addition to marking the beginning of an element, XML start tags also provide a place to specify attributes. An attribute specifies a single property for an element, using a name/value pair. One very well known example of an attribute is href in HTML:

<a href="http://www.yahoo.com/">Yahoo!</a>

In this example, the content of the a element is the text “Yahoo!”; the attribute href provides extra information about the element (in this case, the Web page to load when a user selects the link).


Every attribute assignment consists of two parts: the attribute name (for example, href), and the attribute value (for example, http://www.yahoo.com/). Some rules :

Attribute names in XML (unlike HTML) are case sensitive: HREF and href refer to two different XML attributes.

You may not provide two values for the same attribute in the same start tag. This is wrong:

<!-- WRONG! -->

<a b="x" c="y" b="z">....</a>

Attribute names should never appear in quotation marks, but attribute values must always appear in quotation marks in XML (unlike HTML) using the " or ' characters.

<!-- WRONG! -->

<a b=x>...</a>


A reference allows you to include additional text or markup in an XML document. References always begin with the character “&” (which is specially reserved) and end with the character “;”.

XML has two kinds of references:

entity references

An entity reference, like “&amp;”, contains a name (in this case, “amp”) between the start and end delimiters. The name refers to a predefined string of text and/or markup, like a macro in the C or C++ programming languages.

character references

A character references, like “&#38;”, contains a hash mark (“#”) followed by a number. The number always refers to the Unicode code for a single character, such as 65 for the letter “A” or 233 for the letter “é”, or 8211 for an en-dash.

predeclared references
Predeclared References

Character Predeclared Entities

& &amp;

< &lt;

> &gt;

" &quot;

' &apos;

dtd s
DTD’s ....

This the syntax of an XML document.

The structure (elements, etc) of an XML document

are specified by a “schema”.

If an XML document adheres to a prespecified

schema, it is valid....ie the syntax is compliant with

the schema.

Schemas are specified by DTD’s or XML Schema.

We’ll look at both DTD’s and XML Schema next.

different types of dtd s
Different types of DTD’s

Internal DTD - inside .xml file

<?xml version=“1.0”?>

<!DOCTYPE people [ .... ]>



External DTD - file with .dtd extension

<!ELEMENT ......>

“SYSTEM” (private) vs “PUBLIC”

Local extensions,rules can be added to external reference and

override the external DTD.

using a dtd from within an xml
Using a DTD from within an .xml

<?xml version=“1.0” standalone=“no”?>

<!DOCTYPE people SYSTEM “http://www.dartmouth.edu/~gvc/..”>




Naming DTD’s using Formal Public Identifiers (FPI’s).....

Next class....structure of the DTD and XML Schema.

defining elements
Defining elements

<!ELEMENT people(name,company)>

Elements name and company must be defined elsewhere,

before, after or externally.

<!ELEMENT people(name+, company*)>

means name occurs at least once, company zero or more times.

<!ELEMENT nameandcomp(name|company)>

<!ELEMENT people(name|nameandcomp*)>

+ means at least once, ? means zero or one, * means zero or more

so (name,name,name+) means at least three time, etc.

xml tutorials and references
XMl Tutorials and References
  • Let’s find a few…..
  • XML Parser in Visual Studio