Paper XI : ADVANCED TOOLS IN COMPUTING
UNIT I
XML : Introduction to XML Markup – Parsers and Well formed XML Documents – Parsing a
Document with msxml – Characters – Markup – CDATA Sections – XML Namespaces – Case study: A Day Planner Application Document Type Definition (DTD) : Introduction – Parsers,
Well formed and valid XML Documents – Document Type Declaration – Element Type
Definitions – Attribute Types – Conditional Selection – White space characters – Case Study:
Writing a DTD for the Day Planner Application.
UNIT II
Schemas : Introduction – Schemas vs DTD – Microsoft XML Schema: Describing Elements-
Describing Attributes – Data Types – W3C XML Schema - Case Study: Writing a Microsoft
XML Schema for the Day Planner Application. Document Object Model(DOM) : Introduction –
DOM Implementation – DOM and Java Script – Setup – DOM Components – Creating Nodes –
Traversing the DOM – Modifying the Day Planner Application to use DOM.
UNIT III
XML Technologies and Applications : Introduction – XML Query Language – Directory
Services Markup Language – Resource Definition Framework – XML Topic Maps – Virtual
Glossary – Channel Definition Format – Information and Content Exchange Protocol \ Rich Site
Summary – P3P – Blocks Extensible Exchange Protocol – XML Digital Signatures – Extensible
Tights Markup Language – XML Metadata Interchange – W3C’s XML Protocol – XAML.
UNIT IV
ASP.NET : Introduction - .NET Framework – ASP – Operating Systems – Servers – ASP
Objects – ADO and ADO.NET Objects – ASP Components – Relational DBMS and Other Data
Sources – Developing Distributed Online Application – Client/Server or Tiered Applications.
Programming ASP.NET with Visual Basic .NET : VB .NET Programming Language Structures
– Built in ASP .NET Objects and Interactivity – u\Using the Response Object – The ASP Server
Object
UNIT V
Web Forms and ASP .NET : Programming Web Forms – Web Forms Capabilities – Web Forms
Processing – Web Forms and Events – Creating Web Forms Events Handlers – Building
Interactive Applications with VS .NET – Solutions and Project in VS .NET – Solution Explorer
– Creating a Web Form . ASP .NET Configuration, Scope and State – ASP Application - ASP
.NET Applications – ASP .NET and State – The Application Object – ASP Sessions – The
Session Object. ASP .NET Objects and Components : The Scripting Object Model – Active
Server Components and Controls – More Active Server Components.
REFERENCE BOOKS
1. Dave Mercer, “ ASP.
NET: A Beginner’s Guide”, Tata McGraw-Hill Publishing Company
Limited Edition 2002.
2. H.M. Deitel P.J.Deitel T.R. Nieto T.M. Lin P.Sadu , “XML How to Program“.
3. AI Williams , Kim Barber ,”ASP Solutions” , DreamTech Press 2000.
DEPARTMENT OF COMPUTER SCIENCE
E-LEARNING
CLASS
SUBJECT
: II MSC CS
: ADVANCED TOOLS IN COMPUTING
UNIT I
XML: Introduction to XML Markup – Parsers and Well formed XML Documents –Parsing a
Document with msxml – Characters – Markup – CDATA Sections – XML Namespaces – Case study: A Day Planner Application
Document Type Definition (DTD ): Introduction – Parsers, Well formed and valid XML
Documents – Document Type Declaration – Element Type Definitions – Attribute Types –
Conditional Selection – White space characters – Case Study: Writing a DTD for the Day
Planner Application.
---------------------------------------------------------------------------------------------------------------------
Part A
1.
What is HTML?
HTML is a markup language that is used to structure the documents for delivery on the web
HTML is an application of the Standard Generalized Markup Language (SGML)
2.
Expand HTML.
Hyper Text Markup Language
3.
What is SGML?
SGML is a meta language used to create markup languages such as HTML
4.
Define XML.
XML is a subset of SGML
XML is a technology for creating markup languages to describe data of virtually any type in a structured manner
XML allows documents to describe data more precisely by creating new tags
XML based mark up languages that mark up data such as mathematical formulas, chemical molecular engines, graphics, financial data
5.
Define Well-formed.
An XML document is well-formed if it is syntactically correct
6.
Expand DOM
Document Object Model
7.
Expand SAX
Simple API for XML
8.
Expand URI
Uniform Resource Identifier
9.
What is a parser?
The XML parser reads the XML documents, checks its syntax, reports any errors and allow programmatic access to the document’s contents
10.
List out the basic rules for writing an XML document
XML requires
1.
A single root element
2.
Start and end tag for each element
3.
Properly nested tags
4.
Attribute values in quotes
11.
List out the built in entities used in XML
Ampersand (&)
Left angle bracket (<)
Right angle bracket (>)
Apostrophe (')
Quotation mark (")
12.
Why Namespaces are needed?
Namespace provides a mean for document authors to prevent collisions
State true or false
13.
All XML tags must have a corresponding end tag – True
14.
Internet explorer 5.5 have a in-built parser – True
15.
Character data in a CDATA is processed by the XML parser – False
16.
Both internal and external subset may be specified at the same time – True
17.
Expand EBNF
Extended Backus – Naur Form
18.
1.
Validating
2.
Nonvalidating
What are the types of Parser?
19.
If the document conforms to the DTD, it is referred to as valid .
20.
PCDATA means Parsable Character Data
21.
, (comma) specifies the order in which the elements should occur
22.
Choices are specified using pipeline (|)
23.
List out the occurrence indicators : +, *,?
24.
What are the attribute defaults?
# IMPLIED
# REQUIRED
# FIXED
Part B
1.
Explain the basic syntax of XML program with an example
XML files are commonly stored in text files that end in the extension .xml
Any text editor can be used to create an XML document
A simple example
<?xml version="1.0"?>
<mymessage>
<message> Welcome to XML </message>
</mymessage>
The XML declaration specifies the version of the XML to which the document conforms
All XML documents must contain exactly one root element
The root element contains all other elements in the XML document
Line preceding the root element is called as prolog of the XML document
2.
Write short notes on Parsers and Well-Formed Xml Documents
A software program called a parser is required to process an XML document
The XML parser reads the XML documents, checks its syntax, reports any errors and allow programmatic access to the document’s contents
An XML document is well-formed if it is syntactically correct
XML requires
A single root element
Start and end tag for each element
Properly nested tags
Attribute values in quotes
XML is case sensitive, so proper capitalization must be used in element and attribute names
A document that properly conforms to this syntax is called well-formed document
Parsers can support the Document Object Model (DOM) and / or Simple API for
XML (SAX) for accessing document’s content programmatically using languages such as Java, Python, C etc
A DOM based parser builds a tree structure containing the XML document’s data in memory
A SAX based parser processes the document and generates the events when tags, text, comments are encountered
Internet Explorer 5 have built in XML parsers
The list of parsers are
1.
Msxml
2.
Apache XML
3.
Project parser xerces
4.
Sun Microsystems Java API for XML parsing
5.
IBM’s parser XML for Java
3.
Write short notes on Parsing an Xml Document with Ms-xml
An XML document contains data, not formatting information
When an XML document is loaded into IE5, the document is parsed by msxml
If the document is well formed, the parser makes the document data available to the application (IE5)
IE5 places a plus sign or minus sign next to all elements that contain one or more child elements
This elements store the contents of other elements. Hence it is called as container elements
A minus sign indicates that all the child elements are visible
When a minus sign is clicked, it becomes a plus sign which collapses the container element and hide all its children
If an XML document is not well formed, the parser generates an error
XML DOCUMENT SHOWN IN IE
4.
Describe about the Characters
A character set consists of the characters that may be represented in the document i) Character Set:
XML document may contain the following characters: carriage returns, line feeds and
Unicode characters
Unicode is a standard of Unicode consortium
The goal of Unicode is to enable computers to process the characters for most of the world’s major languages ii) Characters vs. Markup
Markup text is enclosed in angle brackets(< and >)
Character data is the text between start and end tag
Child elements are considered markup, not character data
In the previous example, iii)
<message> and </message> - markup text
Welcome to XML – Character data
White space, entity reference and built-in entities
Spaces, tabs, line feeds and carriage returns are characters commonly called the whitespace characters
An XML parser is required to pass all characters in XML document, including white space characters
An application may consider the white space characters either significant or insignificant
Depending on the application, insignificant white characters may be collapsed into a single white space character or even removed entirely. This process is called as normalization
Almost any character can be used in an XML document, but the characters ampersand
(&), right angle bracket(>), left angle bracket(<), apostrophe(‘) and double quote(“) are reserved in XML and may not be used in character data
To use those reserved characters, we must use entity references which begin with an ampersand and ends with a semicolon
XML provided built in entities such as
Ampersand (&)
Left angle bracket (<)
Right angle bracket (>)
Apostrophe (')
Quotation mark (")
Ex: to use “<>&” as markup characters, then write it as
<message> < > & </message>
Using these entities instead of <, > and & characters prevents the XML processor from mistaking these characters for XML markup
5.
Explain Parsers, well formed and valid XML documents
PARSERS, WELL FORMED AND VALID XML DOCUMENTS
Parsers are generally classified as validating and non validating
A validating parser is to read the DTD and determine whether or not the XML document conforms to it
If the document conforms to the DTD, it is referred to as valid
If the document fails to conform to the DTD but is syntactically correct, it is well formed but not valid
A valid document is well formed
A non validating parser is able to read the DTD, but cannot check the document against the DTD for conformity. If the document is syntactically correct, it is well formed
6.
Explain Document type declaration
DOCUMENT TYPE DECLARATION
DTDs are introduced into XML documents using the DTD
A DTD is placed in the XML document’s prolog and begins with <!DOCTYPE and ends with >
DTD can point to declarations that are outside the XML document(called the external subset) or can contain the declaration inside the document(called the internal subset)
External subsets physically exists in a different file that typically ends with the .dtd
External subsets are specified using the keywords SYSTEM or PUBLIC
<!DOCTYPE root_element [
internal_DTD_statements
]>
<!DOCTYPE root_element SYSTEM "DTD_location">
<!DOCTYPE root_element SYSTEM "DTD_location" [
internal_DTD_statements
]>
<!DOCTYPE root_element PUBLIC "DTD_name" "DTD_location">
<!DOCTYPE root_element PUBLIC "DTD_name" "DTD_location"
internal_DTD_statements
]>
Both the internal and external subset may be specified at the same time
General rules about the DOCTYPE statement:
It must appear right after the "xml" processing instruction and before the root element.
"root_element" names the root element of the XML document.
Key word "SYSTEM" indicates that the external DTD file specified as "DTD_location"
is private.
Key word "PUBLIC" indicates that the external DTD file specified as "DTD_location" is
public.
"DTD_location" is a URL of the external DTD file.
"DTD_name" is a publicly recognized name of a specific DTD file, like "-//W3C//DTD
HTML 4.0 Transitional//EN".
If an internal DTD statement is conflicting with an external statement, the internal statement takes precedence.
7.
Explain Attribute declarations
ATTRIBUTE DECLARATIONS
An attribute declaration specifies an attribute list for an element by using the
ATTLIST attribute list declaration
An element can have any no. of attribute
Ex <! ELEMENT x EMPTY>
<! ATTLIST x y CDATA #REQUIRED>
y is an attribute of the element x
CDATA indicates that y can contain any character text except for the <, >, & etc.
# REQUIRED -> specifies that the attribute must be provided for the element x
Attribute Defaults
# IMPLIED – if the attribute does not appear in the element, then the application using the
XML document can use whatever value it chooses
# REQUIRED – the attribute must appear in the element
The XML document is not valid if the attribute is missing
# FIXED – attribute value is constant and cannot be different in the XML document
Ex <! ATTLIST address zip #FIXED “02115”>
8.
Write short notes on Conditional sections and whitespace characters
CONDITIONAL SECTIONS
DTDs provide the ability to include or exclude declarations using conditional sections
INCLUDE – specifies that the declarations are included
IGNORE – specifies that the declarations are excluded
<!ENTITY % draft 'INCLUDE' >
<!ENTITY % final 'IGNORE' >
<![%draft;[
<!ELEMENT book (comments*, title, body, supplements?)>
]]>
<![%final;[
<!ELEMENT book (title, body, supplements?)>
]]>
WHITESPACE CHARACTERS
Whitespace is either preserved or normalized depending on the context in which it is used
PART C
1.
Explain with an example markups
XML element markup consists of a start tag, content and an end tag
All XML tags must have a corresponding end tag
Ex : <img src = “im.gif”> is correct in HTML but in XML, the ending tag must also be supplied as in <img src = “im.gif”></img>
This type of element is called an empty element, because it does not contain any content
The empty tag can be written more concisely as
<img src = “im.gif” />
Element defines structures
An element may or may not contain content
Attribute describe elements
An element may have zero, one or more attributes associated with it
Attributes are placed within the element’s start tag
Attribute values are enclosed in quotes either single or double
<car doors = “4” />
XML elements and attribute names can be of any length
Example
XML file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="tutorials.xsl"?>
<tutorials>
<tutorial>
<name>XML Tutorial</name>
<url>http://www.quackit.com/xml/tutorial</url>
</tutorial>
<tutorial>
<name>HTML Tutorial</name>
<url>http://www.quackit.com/html/tutorial</url>
</tutorial>
</tutorials>
XSL file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>XML XSL Example</title>
<style type="text/css"> body
{ margin:10px; background-color:#ccff00; font-family:verdana,helvetica,sans-serif;
}
.tutorial-name
{ display:block; font-weight:bold;
}
.tutorial-url
{ display:block; color:#636363; font-size:small; font-style:italic;
}
</style>
</head>
<body>
<h2>Cool Tutorials</h2>
<p>Hey, check out these tutorials!</p>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="tutorial">
<span class="tutorial-name"><xsl:value-of select="name"/></span>
<span class="tutorial-url"><xsl:value-of select="url"/></span>
</xsl:template>
</xsl:stylesheet>
Processing Instruction
<?xml-stylesheet type="text/xsl" href="tutorials.xsl"?> is an example of processing instruction(PI)
The information contained in a PI is passed to the application using the XML document and provides additional application specific instruction about the document
Processing instructions are delimited by <? and ?> and consists of a PI target and PI value
PI target : xml:stylesheet
PI value: type = “text/sl” href=”tutorials.xsl”
Document authors may create their own PIs.
PI provide a convenient syntax to allow document authors to embed application specific data within an XML document
2.
CDATA SECTION
Write about CDATA section and XML namespaces
It contains text, reserved characters and whitespace characters
Character data in a CDATA is not processed by the XML parser
A common use of CDATA section is for scripting code (e.g Java script)
Example
<script>
<![CDATA[ function matchwo(a,b)
{ if (a < b && a < 0) then
{
return 1;
} else
{
return 0;
}
}
]]>
</script>
In the example above, everything inside the CDATA section is ignored by the parser.
A CDATA section cannot contain the string "]]>".
Nested CDATA sections are not allowed.
The "]]>" that marks the end of the CDATA section cannot contain spaces or line breaks.
XML NAMESPACES
Because XML allows document authors to create their own tags, naming collisions can occur
Naming collisions – Two different elements that have the same name
Namespace provides a mean for document authors to prevent collisions
Each namespace prefix is tied to a uniform resource identifier(URI) that uniquely identifies the namespace
Virtually any name may be used for a namespace, except the reserved namespace xml
URI is a series of characters to differentiate names
In order to ensure that a namespace is unique, the document author must provide a unique URI
The URIs are never visited by the parser
The URIs need not even exists or be properly formed
<? xml version = “1.0”?>
<directory xmlns:text= “urn:deitel:textinfo” xmlns:image=”urn:deitel:imageinfo”>
<text:file filename = “book.xml”>
<text:description> A book list </ text:description>
</text: file>
<image:file filename = “funny.jpg”>
<image:description> A funny picture </ image:description>
</image: file>
</directory>
3.
Explain Element type declarations
ELEMENT TYPE DECLARATIONS
Elements are the primary building blocks used in XML documents
They are declared in DTD with element type declaration(ELEMENT)
ex
<! ELEMENT myelement (#PCDATA) >
The element name is called a generic identifier
The set of parentheses that follow the element name specify the element’s allowed content and is called the content specification
Keyword PCDATA specifies that the element must contain Parsable character data
This data will be parsed by the parser and any markup text (<, >, &, ..) will be treated as markup
<?xml version="1.0"?>
<! DOCTYPE mymessage SYSTEM “intro.dtd”>
<mymessage>
<message> Welcome to XML </message>
</mymessage>
<! ELEMENT mymessage (message) >
<! ELEMENT message (#PCDATA)>
If an XML document’s structure is inconsistent with its corresponding DTD, but is syntactically correct, it is only well formed not valid
Sequences, Pipe characters and Occurrence Indicators
DTDs allow the document authors to define the order and frequency of child elements
The comma (,) called a sequence – specifies the order in which the elements must occur
<! Element Classroom (teacher , student)>
The content specification can contain any no. of items in a sequence
Choices are specified using the pipe character (|)
<! Element gender (male | female)>
An elements frequency (i.e. Number of occurrences) is specified by using either the
Plus sign(+), asterisk(*) or question mark(?) occurrence indicator
Plus sign: An element can appear any no. of tims, but must be appear at least once
<! Element album (song +)>
Asterisk sign: an element is optional and if used, the element can appear any no. of times
<! Element library (book*)>
Question mark: an element is optional and if used, the element can appear only once
<! Element seat (person?)>
Empty, Mixed content and ANY
EMPTY declares empty elements
Empty elements do not contain character data or child elements
<! Element oven EMPTY>
An element can also be declared as having mixed content. Such elements may contain any contain any combination of elements and PCDATA
<! Element mymessage (#PCDATA | message) >
An element declared as type ANY can contain any content including PCDATA, elements or a combination of elements and PCDATA. Elements with ANY content can also be empty elements
4. Explain Attribute types
ATTRIBUTE TYPES
Attribute types are classified as either strings, tokenized or enumerated
String attribute types do not impose any constraints on attribute values – other than disallowing <, >, & etc
Tokenized attributes impose constraints on attribute values – such as which characters are permitted in an attribute name
Enumerated attribute types – it can take only one of the values listed in the attribute declaration
Tokenized Attribute Type (ID, IDREF, ENTITY, NMTOKEN)
It allow a DTD author to restrict the values used for the attributes
ID – uniquely identifies an element
IDREF – points to elements with an ID attribute
Ex:
<! ATTLIST shipping shipID ID #REQUIRED>
….
<! ATTLIST book shippedby IDREF #IMPLIED>
A validating parser verifies that every ID attribute type referenced by IDREF is in the XML document
A parser replaces entity references with their values
Entity attributes – an attribute has an entity for its value
The primary constraint placed on ENTITY is that they must refer to external unparsed entities
an external unparsed entity is defined in the external subset of a DTD and consists of character data that will not be parsed by the XML parser
<! ENTITY digits “0123456789”>
<useanentity>&digits;</useanentity>
NMToken(name token) – value consists of letters, digits, periods, underscores, hyphens and colon characters
<! ATTLIST sportsclub phone NMTOKEN #REQUIRED>
Enumerated Attribute Types
It declare lists of possible values an attribute can have
The attribute must be assigned with a value from this list to conform to the DTD
Enumerated type values are separated by pipe characters’
<! ATTLIST person gender (M | F) “F”>
A default value of “F” is assigned in the case of gender not mentioned
NOTATION provides information that an application using the XML document can use to handle unparsed entities
<! ATTLIST book reference NOTATION ( Java | C ) “C”>
The notation for C might be declared as
<! NOTATION C SYSTEM http://www.deitel.com/books/chpt3/chpy3.html
>