SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
1 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
UNIT III XML
XML: Introduction- Revolutions of XML-XML Basics
Defining XML Documents: DTD-XML Schema-Namespaces
XFiles: XLink – XPointer - XPath
XSL Technologies: XML with XSL (XSLT)– XSL-FO
Parsing XML using DOM - SAX - Integrating XML with database
Formatting XML on the web.
XML
3.1 INTRODUCTION
 XML, the eXtensible Markup Language, is best described as a means of
structuring data.
 XML provides rules for placing text and other media into structures and allows
you to manage and manipulate the results.
 The XML standard is a subset of the Standard Generalized Markup Language
(SGML), and was developed in 1996 by the SGML Editorial Review Board
under the auspices of World Wide Web Consortium (W3C).
 XML is designed for that express purpose. XML provides a mechanism for the
interchange of Structured information on the web.
 This sort of data is required to transform the web from a publishing media to an
application processing environment.
XML Design Goals
The design goals for XML were proposed by the World Wide Web Consortium
(W3C) and published in January 1998.
The usage of XML was aimed at
 Should be usable over the internet
 Should support a wide variety of applications
 Should be compatible with SGML and XML documents should be easy to create
Also XML can be used for
 Data Exchange
 Store and Retrieve Data
The Role of XML
 XML was created to structure, store and transport information. It is just plain
text.
 Software that can handle plain text can also handle XML.
 It is the most common tool for data transmissions between all sort of
applications, and is popular in the area of storing and describing information
Some Examples: Books, Financial transactions (EDI), Technical manuals, Chemical
formulae, Medical records, Museum catalog records, Encyclopaedia entries.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
2 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
3.2 REVOLUTIONS OF XML
1. The Data Revolution
 XML's strength is its data independence. XML is pure data description, not tied to
any programming language, operating system, or transport protocol.
 XML's sole focus on data means that a variety of transport technologies may be
used to move XML across the Web.
 As a result, protocols such as HTTP have had a tremendous impact on XML's
viability and have opened the door to alternatives to CORBA, RMI, and DCOM,
which don't work over TCP/IP.
 XML does this by focusing on data and leaving other issues to supporting
technologies
Figure: The Data Revolution
2. The Architectural Revolution
 The focal point of this change in architectural thinking has been a move from
tightly coupled systems based on established infrastructures such as CORBA,
RMI, and DCOM, each with their own transport protocol, to loosely coupled
systems riding atop standard Web protocols such as TCP/IP.
 Although the transport protocols underlying CORBA, RMI, and DCOM provide for
efficient communication between nodes, their drawback is their inability to
communicate with other tightly coupled systems or directly with the Web.
 Loosely coupled Web-based systems, on the other hand, provide what has long
been considered the Holy Grail of computing: universal connectivity.
 Using TCP/IP as the transport, systems can establish connections with each
other using common open-Web protocols.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
3 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
 Although it is possible to build software bridges linking tightly coupled systems
with each other and the Web, such efforts are not trivial and add another layer of
complexity on top of an already complex infrastructure.
Figure: The Architectural Revolution
3. The Software Revolution
 XML is also part of a revolution in how we build software. During the 1970s and
1980s, software was constructed as monolithic applications built to solve
specific problems.
 The problem with large software projects is that, by trying to tackle multiple
problems at once, the software is often ill-suited to adding new functionality and
adapting to technological change.
 In the 1990s a different model for software emerged based on the concept of
simplicity.
 As Figure illustrates, instead of trying to define all requirements up front, this
new philosophy was built around the concept of creating building blocks capable
of combination with other building blocks that either already existed or were yet
to be created.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
4 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Figure: The Software Revolution
3.3 XML BASICS
1. XML Delimiter Characters
 Markup text has a couple rules.
 First, it needs to be differentiated from the rest of the document text by a unique
set of characters that delineates where the markup information starts and ends.
 These special characters are known as delimiters. The XML language has four
special delimiters
2. A Simple XML Document
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
5 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
3. XML Declaration
 The XML declaration is a processing instruction of the form <?xml ...?>.
 The XML declaration indicates the presence of external markup declarations and
character encoding.
 The XML declaration consists of a number of components.
4. Document Type Declaration
 The Document Type Declaration (DOCTYPE) gives a name to the XML content
and provides a means to guarantee the document’s validity, either by including
or specifying a link to a Document Type Definition (DTD).
 The keyword NAME should be replaced with the actual root element contained
in the document, and the “file” keyword should be replaced with a path to a valid
DTD.
 In the case of our shirt example, the DOCTYPE is
<!DOCTYPE shirt SYSTEM “shirt.dtd”>
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
6 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
5. Attributes
Within elements, additional information can be communicated to XML
processors that modifies the nature of the encapsulated content. For example, we may
have specified a <price> element, but how do we know what currency this applies to?
DEFINING XML DOCUMENTS
3.4 DOCUMENTS TYPE DEFINITIONS
 DTD stands for Document Type Definition. A Document Type Definition allows the
XML author to define a set of rules for an XML document to make it valid.
 An XML document is considered “well formed” if that document is syntactically
correct according to the syntax rules of XML 1.0.
Some Simple DTD Examples
An Internal DTD
An External DTD
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
7 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
1. DTD Elements
 All elements in a valid XML document are defined with an element declaration in
the DTD.
 An element declaration defines the name and all allowed contents of an element.
 Element names must start with a letter or an underscore and may contain any
combination of letters, numbers, underscores, dashes, and periods.
 Element names must never start with the string “xml”.
 Colons should not be used in element names because they are normally used to
reference namespaces.
Each element in the DTD should be defined with the following syntax:
<!ELEMENT elementname rule >
 ELEMENT is the tag name that specifies that this is an element definition.
 elementname is the name of the element.
 rule is the definition to which the element’s data content must conform.
contactlist.dtd
contactlist.xml
2. DTD Element Rules
 All data contained in an element must follow a set rule.
 The rule is the definition to which the element’s data content must conform.
 There are two basic types of rules that elements must fall into.
 The first type of rule deals with content. The second type of rule deals with
structure.
i) Content Rules
 The content rules for .elements deal with the actual data that defined elements
may contain.
 These rules include the ANY rule, the EMPTY rule, and the #PCDATA rule.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
8 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
a) The ANY Rule
An element may be defined. using the ANY rule. The element may contain other
elements and/or normal character data. An element using the ANY rule would appear
as follows:
<!ELEMENT elementname ANY>
XML Fragments Using the ANY Rule
b) The EMPTY Rule
This rule is the exact opposite of the ANY rule. An element that is defined with
this rule will contain no data. However, an element with the EMPTY rule could still
contain attributes (more on attributes in a bit). The following element is an example of
the EMPTY rule:
<!ELEMENT elementname EMPTY>
c) The #PCDATA Rule
 The #PCDATA rule indicates that parsed character data will be contained in the
element.
 Parsed character data is data that may contain normal markup and will be
interpreted and parsed by any XML parser accessing the document.
The following element demonstrates the #PCDATA rule:
<!ELEMENT elementname (#PCDATA)>
ii) Structure Rules
 Whereas the content rules. deal with the actual content of the data contained in
defined elements, structure rules deal with how that data may be organized.
 There are two types of structure rules. The first is the “element only” rule. The
second rule is the “mixed” rule.
a) The “Element Only” Rule
 The “element only” rule .specifies that only elements may appear as children of
the current element.
 The child element sequences should be separated by commas and listed in the
order they should appear.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
9 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
 If there are to be options for which elements will appear, the listed elements
should be separated by the pipe symbol (|).
The following element definition demonstrates the “element only” rule:
<!ELEMENT elementname (element1, element2, element3)>
b) The “Mixed” Rule
 The “mixed” rule is used to help define elements that may have both character
data (#PCDATA) and child elements in the data they contain.
 A list of options or a sequential list will be enclosed by parentheses. Options will
be separated by the pipe symbol (|), whereas sequential lists will be separated by
commas.
The following element is an example of the “mixed” rule:
<!ELEMENT elementname (#PCDATA | childelement1 | childelement2)*>
3. DTD Attributes
Attribute list declarations in a DTD will have the following syntax:
<!ATTLIST elementname attributename type defaultbehavior defaultvalue>
 ATTLIST is the tag name that specifies that this definition will be for an attribute
list.
 elementname is the name of the element that the attribute will be attached to.
 attributename is the actual name of the attribute.
 type indicates which of the 10 valid kinds of attributes this attribute definition
will be.
 defaultbehavior dictates whether the attribute will be required, optional, or fixed
in value. This setting determines how a validating parser should relate to this
attribute.
 defaultvalue is the value of the attribute if no value is explicitly set.
4. DTD Entities
 Entities in DTDs are storage units. They can also be considered placeholders.
 Entities are special markups that contain content for insertion into the XML
document.
The general syntax of an entity is as follows:
<!ENTITY entityname [SYSTEM | PUBLIC] entitycontent>
 ENTITY is the tag name that specifies that this definition will be for an entity.
 entityname is the name by which the entity will be referred in the XML
document.
 entitycontent is the actual contents of the entity—the data for which the entity is
 serving as a placeholder.
 SYSTEM and PUBLIC are optional keywords. Either one can be added to the
definition of an entity to indicate that the entity refers to external content.
i) External Entities
 External entities are used to reference external content. External entities get
their content by referencing it via a URL placed in the entitycontent portion of
the entity declaration.
 Either the SYSTEM keyword or the PUBLIC keyword is used here to let the XML
parser know that the content is external.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
10 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
ii) Parameter Entities
Parameter entities can be useful when you have to use a lot of repetitive or lengthy text
in a DTD. Use the following syntax for parameter entities:
<!ENTITY % entityname entitycontent>
5. More DTD Directives
i) The IGNORE Keyword
 When developing or updating a DTD, you may need to comment out parts of the
DTD that are not yet reflected in the XML documents that use the DTD.
 You could use a normal comment directive, or you can use an IGNORE directive.
The syntax for IGNORE
<![ IGNORE
This is the part of the DTD ignored
]]>
Example
<!ELEMENT Employee <![ IGNORE (#PCDATA) ]]> (Name, Address, Phone) >
ii) The INCLUDE Keyword
The INCLUDE directive marks declarations to be included in the document.
<![ INCLUDE
This is the part of the DTD included
]]>
iii) Comments Within a DTD
Comments can also be added to DTDs. Comments within a DTD are just like comments
in HTML and take the following syntax:
<!-- Everything between the opening tag and closing tag is a comment -->
6. Drawbacks of DTD
 Use of non-XML syntax.
 No support for data typing.
 Non-extensibility.
3.5 XML SCHEMA
 The XML Schema Definition Language is an XML language for describing and
constraining the content of XML documents.
 XML Schema is a W3C recommendation.
 XML Schema defines what it means for an XML document to be valid.
 XML Schema are a radical departure from Document Type Definitions (DTDs),
the existing schema mechanism inherited from SGML.
1. Usage of XML Schemas
 It support data types.
 It uses XML syntax.
 It has secure data communication.
 XML Schemas are extensible.
 When using XML Schemas most of the errors can be taken care of by the
validating software.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
11 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
2. XML Schema Definition
 Elements that can appear in a document.
 Attributes that can appear in a document.
 The elements that are child elements.
 The order of child elements.
 The number of child elements.
 The criteria whether an element is empty or can include text.
 Data types for elements and attributes.
 Default and fixed values for elements and attributes.
3. XML Schema Data Types
XSD String: String data types are used for values that contains character strings.
XSD Date: Date and time data types are used for values that contain date and time.
XSD Numeric: Numeric data types are used for numeric values.
XSD Misc: Other miscellaneous data types like boolean, base64Binary, hexBinary, float,
double etc.
4. Types of Indicators
i) Order indicators
a) All Indicator
The <all> indicator specifies, by default, that the child elements can appear in
any order and that each child element must occur once and only once.
<xs:element name="book">
<xs:complexType>
<xs:all>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
b)Choice Indicator
The <choice> indicator specifies that either one child element or another can
occur.
<xs:element name="person">
<xs:complexType>
<xs:choice>
<xs:element name="employee" type="employee"/>
<xs:element name="member" type="member"/>
</xs:choice>
</xs:complexType>
</xs:element>
c) Sequence Indicator
The <sequence> indicator specifies that the child elements must appear in a
specific order.
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
12 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
<xs:element name="author" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
ii) Occurrence Indicators
Occurrence indicators are used to define how often an element can occur. For
Order and group indicators, the default value for maxOccurs and minOccurs is 1.
The <maxOccurs> indicator specifies the maximum number of times an element
can occur.
The <minOccurs> indicator specifies the minimum number of times an element
can occur.
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="vendor" type="xs:string" maxOccurs="2" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
iii) Group Indicators
Group indicators are used to define related sets of elements. Element groups are
defined with group declaration.
<xs:group name="persongroup">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lasstname" type="xs:string"/>
<xs:element name="birthday" type="xs:string"/>
</xs:sequence>
</xs:group>
<xs:element name="person" type="personinfo"/>
<xs:complexType name="personinfo">
<xs:sequence>
<xs:group ref="persongroup"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
EXAMPLE FOR XML SCHEMA
companyschema.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employees">
<xs:complexType>
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
13 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
<xs:sequence>
<xs:element maxOccurs="unbounded" name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Salary" type="xs:unsignedShort" />
<xs:element name="ProId" type="xs:unsignedByte" />
<xs:element name="ProName" type="xs:string" />
<xs:element name="SBUName" type="xs:string" />
<xs:element name="SBULoc" type="xs:string" />
</xs:sequence>
<xs:attribute name="code" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
companyschema.xml
<?xml version="1.0" encoding="utf-8"?>
<employees>
<employee code="001">
<Name>Arun</Name>
<Salary>20000</Salary>
<ProId>101</ProId>
<ProName>Mainframe</ProName>
<SBUName>Programmer</SBUName>
<SBULoc>Chennai</SBULoc>
</employee>
</employees>
3.6 NAMESPACES
As it is possible for using the same name in different contexts, it is quite possible
for XML documents to use an element name for specifying different things. This would
cause a name conflict when one wants to merge these documents.
Sample 1 (Name Conflict)
<word>
<head> Ethic </head>
<definition>
Rules of behaviour based on ideas
</definition>
</word>
Sample 2 (Name Conflict)
<word>
<filename> test.doc </filename>
<category> Technical Report 1 </category>
</word>
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
14 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
The reason for the conflict is because the element "word" has been defined in
two different ways in these documents, where neither their sub-elements names or
their contents match.
If one tries to merge these two documents, they would receive an error
indicating that a name conflict has happened that cannot be resolved. In order to
resolve these kind of conflicts, XML uses a mechanism that is called namespace.
A namespace is simply a label to an environment, including addresses, module
names, file names, file locations, and such, within which a "name" is unique.
Namespace allows programmers to make sure that certain names are unique
across an application and not just in a single program.
A namespace allows programmers to define a set of names without any
ambiguity.
1. Name Conflict Resolution using a Prefix
A straightforward method to resolve naming conflict is to use a prefix to the
names. For example we can use two prefixes for the previous examples to avoid name
conflict.
Sample 1 (using prefix for Name Conflict resolution)
<dic:word>
<head> Ethic </head>
<definition>
Rules of behaviour based on ideas
</definition>
</dic:word>
Sample 2 (using prefix for Name Conflict resolution)
<proc:word>
<filename> test.doc </filename>
<category> Technical Report 1 </category>
</proc:word>
The prefixes "dic" and "proc" now qualify the words, providing two new names that are
different from each other, hence they have no conflict any more.
2. XML Namespace
In XML the namespace is defined by using an attribute that is called xmlns. The
main rules for XML namespace definition are
 The value of the attribute specifies the location that the namespace could be
found.
 The namespace attribute can appear in the start-tag of an element, in which case
all children of that element would be associated to the same namespace.
 The namespace can appear in the root element, in which case the whole
document would be associated to the defined namespace.
 As xmlns is an attribute, it can have several prefixes making each one unique,
hence it is possible to define several namespace within a tag.
 The children (sub-elements) should be prefixed by the defined prefix.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
15 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Syntax:
xmlns:prefix="URI"
prefix: is any valid string
URI: is an abbreviation for "Uniform Resource Identifier", which must be a valid Internet
Resource.
Example:
xmlns="http://www.w3.org/HTML/1998/html4"
3. Default Namespace
A useful way to avoid repeating prefixes in front of every child element is to
define a default namespace. Default namespace does not have any prefix.
Syntax:
xmlns:="URI"
prefix: is any valid string
URI: is an abbreviation for "Uniform Resource Identifier", which must be a valid Internet
Resource.
Example:
xmlns="http://www.w3.org/1999/xhtml"
XFILES
3.7 XLINK
The XML Linking Language, XLink, addresses and overcomes the limitations of
anchor element, <a> in HTML by allowing a link to another document to be specified on
any element within an XML document.
The XML Linking Language creates a link to another resource through the use of
attributes specified on elements, not through the actual elements themselves.
XLink Attributes
1. xlink:type
This attribute must be specified and indicates what type of XLink is represented
or defined.
The xlink:type attribute must contain one of the following values:
i) Simple
A value of simple creates a simple link between resources. Indicating a value of
extended creates an extended link.
ii) Locator
A value of locator creates a link that points to another resource.
iii) Arc
A value of arc creates an arc with multiple resources and various traversal paths.
iv) Resource
A resource value creates a link to indicate a specific resource.
v) Title
A value of title creates a title link.
vi) None
For all intents and purposes, a value of none removes the ability to link to
another resource from an element.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
16 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
2. xlink:role
The xlink:role attribute specifies the function of the link. However, you cannot
use this attribute with just any type of XLink. This attribute may only be used for the
following XLink types:
 extended
 simple
 locator
 resource
3. xlink:arcrole
The xlink:arcrole attribute may only be used with two types of XLinks:
 arc
 simple
4. xlink:title
The xlink:title attribute is completely optional and is provided for us to make
some sense of and document, in a way, what a particular link is. If the xlink:title
attribute is specified, it should contain a string describing the resource.
5. xlink:show
The xlink:show attribute is an optionally specified attribute for a link for the
simple and arc XLink types and will accept the following values:
 new
 replace
 embed
 other
 none
6. xlink:actuate
The xlink:actuate attribute is used to indicate when the linked resource should
be loaded. This attribute will accept the following values:
 onLoad
 onRequest
 other
 none
7. xlink:label
The xlink:label attribute is used to name resource and locator XLink types. This
value will end up being used as values within the xlink:from and xlink:to attributes to
indicate the starting and ending resources for an arc XLink type.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
17 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Example: Sample3.xml
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
18 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
3.8 XPOINTER
An XPointer describes a location within an external document, an XPointer can
target a point within that XML document or a range within the target XML document.
 XPointer provides two more important node tests:
 point()
 range()
The XPointer specification also adds an additional function named unique(). This
new function indicates whether an XPointer expression selects a single location rather
than multiple locations or no locations at all.
For an XPointer expression, the result is known as a location set.
Some XPointer Functions That Return Location Sets
1. Points
Two different types of points can be represented using XPointer points:
 Node points
 Character points
i) Node Point
 Node points are location points in an XML document that are nodes that contain
child nodes.
 For these node points, the index position indicates after which child node to
navigate to.
 If 0 is specified for the index, the point is considered to be immediately before
any child nodes.
 A node point could be considered to be the gap between the child nodes of a
container node.
ii) Character Point
 When the origin node is a text node, the index position indicates the number of
characters. These location points are referred to as character points.
 Because you are indicating the number of characters from the origin, the index
specified must be an integer greater than or equal to 0 and less than or equal to
the total length of the text within the text node.
 By specifying 0 for the index position in a character point, the point is considered
to be immediately before the first character in the text string.
 For a character point, the point, conceptually, represents the space between the
characters of a text string.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
19 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Example
<People>
<Person>
<Name>Dillon Larsen</Name>
<Address>
<Street>123 Jones Rd.</Street>
<City>Houston</City>
<State>TX</State>
<Zip>77380</Zip>
</Address>
</Person>
<Person>
<Name>Madi Larsen</Name>
<Address>
<Street>456 Hickory Ln.</Street>
<City>Houston</City>
<State>TX</State>
<Zip>77069</Zip>
</Address>
</Person>
</People>
Examples of XPointer Points and the Resulting Locations
2. Ranges
 An XPointer range defines just that—a range consisting of a start point and an
endpoint.
 A range will contain the XML between the start point and endpoint but does not
necessarily have to consist of neat subtrees of an XML document.
 A range can extend over multiple branches of an XML document.
 The only criterion is that the start point and endpoint must be valid.
The general syntax for string-range() is as follows:
string-range(location-set, string, [index, [length]])
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
20 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
XPointer Range Functions
3.9 XPATH
 The XML Path Language (XPath) is a standard for creating expressions that can
be used to find specific pieces of information within an XML document.
 XPath expressions are used by both XSLT (for which XPath provides the core
functionality) and XPointer to locate a set of nodes.
 XPath expressions have the ability to locate nodes based on the node's type,
name, or value or by the relationship of the nodes to other nodes within the XML
document.
 An XPath expression can also return any of the following:
 A node set
 A Boolean value
 A string value
 A numeric value
1. Operators and Special Characters
 XPath expressions are composed using a set of operators and special characters,
each with its own meaning.
 The various operators and special characters used within the XML Path
Language are listed below.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
21 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
The priority for evaluating XPath expressions is as follows:
1. Grouping
2. Filters
3. Path operations
2. XPath Syntax
 The XML Path Language provides a declarative notation, termed a pattern, used
to select the desired set of nodes from XML documents.
 Each pattern describes a set of matching nodes to select from a hierarchical XML
document.
 A location path is, itself, made up of one or more location steps. Each step is
further comprised of three pieces:
 An axis
 A node test
 A predicate
 Therefore, the basic syntax for an XPath expression
axis::node test[predicate]
i) Axes
The axis portion of the location step identifies the hierarchical relationship for
the desired nodes from the current context. An axis for a location step could be any of
the items below.
XPath Axes for a Location Step
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
22 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
ii) A Node Test
 The node test portion of a location step indicates the type of node desired for the
results.
 Every axis has a principal node type: If an axis is an element, the principal node
type is element; otherwise, it is the type of node the axis can contain.
 For instance, if the axis is attribute, the principal node type is attribute.
In addition to specifying an actual node name, other node tests are available to select
the desired nodes. Here’s a list of these node tests:
 comment()
 node()
 processing-instruction()
 text()
iii) Predicates
 The predicate portion of a location step filters a node set on the specified axis to
create a new node set.
 Each node in the preliminary node set is evaluated against the predicate to see
whether it matches the filter criteria.
 If it does, the node ends up in the filtered node set. Otherwise, it doesn’t.
3. XPath Functions
XPath functions are used to evaluate XPath expressions and can be divided into
one of four main groups:
 Boolean
 Node set
 Number
 String
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
23 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
4. XPath Examples
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
24 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
XSL TECHNOLOGIES
XML Stylesheet Language (XSL) has two independent languages:
 The XSL Transformation Language (XSLT)
 The XSL Formatting Object Language (XSL-FO)
3.10 XML WITH XSL (XSLT)
XSLT is used to convert an XML document to another format.
1. XSLT for Document Publishing
 XSL technology has an important role in the field of document publishing.
Imagine, for example, that we have an XML document for a list of books.
 We would like to publish this document in various formats. Using XSL, we can
convert the book list to an HTML file, PDF document, or other format.
 The key to this example is the XML document, which serves as a single data
source. By applying an XSL style sheet, we render a new view of the data.
Figure: Publishing documents with XSLT.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
25 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Figure: Sending data to the XSLT processor.
2. Getting Started with XSLT
i) Creating the XML Document
The XML document, book.xml, contains elements for the author, title, price,
summary, and category.
ii) Creating the XSL Style Sheet
 The next step is to create the XSL style sheet. XSL style sheets are XML
documents; as a result, they must be well formed.
 The <xsl:stylesheet> element defines how the XSLT processor should process the
current XSL document. The xmlns attribute is the namespace definition.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
26 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
3. The XSLT Processor
4. Implementing Client-Side XSLT Processing
 For client-side processing, the XML document requires a special processing
instruction to reference the XSL style sheet.
 The processing instruction is <?xml-stylesheet>, and it has two attributes: type
and href.
 The type attribute specifies the content type of the document to be retrieved (in
this case, text/xsl).
 The href attribute is a URL reference to the style sheet.
book.xml
book_view.xsl
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
27 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
5. Implementing Server-Side XSLT Processing
i) ASP: Server-Side XSLT Processing
In order to develop using ASP, you will need the IIS Web server and the latest
version of the Microsoft XML parser. The required components are listed below.:
Microsoft IIS Web Server 5.0: This version of IIS is included with Microsoft Windows
2000 Professional. You can also use IIS 4.0 or Personal Web Server (PWS); however, you
will have to install the Windows NT Option Pack 4.
Microsoft XML Parser 3.0: If you have IE 6 installed on your server machine, then MS
XML Parser 3.0 is included. The MS XML Parser 3.0 is also available as a separate
download from http://msdn.microsoft.com.
book_test.asp
ii) JSP: Server-Side XSLT Processing
Sun Microsystems’ Software Development Kit (SDK) 1.3 (or higher):. The SDK is
available at Sun’s Web site, http://java.sun.com/j2se. Follow the installation
instructions provided with the SDK.
Apache Tomcat Server 4: Apache Tomcat 4 is the official reference implementation for
JSP 1.2 and Java Servlets 2.3. If your application server already supports JSP 1.1 or
higher, there is no requirement to install Tomcat. Apache Tomcat 4 is available from the
Apache Web site, http://jakarta.apache.org/tomcat. Follow the installation instructions
provided with the Tomcat server.
book_test.jsp
6. Advanced Features of XSLT
i) Looping
 The XSLT element <xsl: for-each> is used for looping through a list of elements.
 The <xsl: for-each> element is commonly used in the Web development world to
convert an XML document to an HTML table.
booklist_loop.xsl
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
28 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
ii) Sorting
In XSLT, the <xsl:sort> element is used for sorting the XML data. It is possible to
sort based on a single key or multiple keys. The syntax for the <xsl:sort> element is
shown here:
<xsl:sort
select = string-expression
order = { “ascending” | “descending” }
data-type = { “text” | “number” }
case-order = {“upper-first” | “lower-first” }
lang = { nmtoken } />
booklist_sort.xsl
iii) Conditionals
During an XSLT transformation, the style sheet can perform conditional tests on
the data. XSLT contains a very simple if-then conditional.
iv) Filters
 In relation to conditional tests, XSLT can also filter the data based on a given
expression.
 When data is selected using the <xsl: for-each> element, the expression can
contain a filter.
 For example, you can filter the data to contain only Java books.
 The following code snippet performs the desired operation:
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
29 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
3.11 XSL FORMATTING OBJECTS (XSL-FO)
The XSL technology is also composed of XSL Formatting Objects (XSL-FO). XSL-
FO was designed to assist with the printing and displaying of XML data. The main
emphasis is on the document layout and structure.
1. XSL-FO Formatting Engines
2. Basic Document Structure
 An XML-FO document follows the syntax rules of XML; as a result, it is well
formed.
 XSL-FO elements use the following namespace:
http://www.w3.org/1999/XSL/Format
 The following code snippet shows the basic document setup for XSL-FO:
<?xml version=”1.0” encoding=”utf-8”?>
<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”>
<!-- layout master set -->
<!-- page masters: size and layout -->
<!-- page sequences and content -->
</fo:root>
 The element <fo:root> is the root element for the XSL-FO document. An XSL-FO
document can contain the following components:
 Page master
 Page master set
 Page sequences
i) Page Master: <fo:page-master>
The page master describes the page size and layout. The page master contains
the dimensions for a page, including width, height, and margins.
The <fo:simple-page-master> element defines the layout of a page. The following
code snippet describes a U.S. letter:
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
30 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Figure: Components of a Page Master
XSL-FO Dimensions
ii) Page Master Set: <fo:page-master-set>
A document can be composed of multiple pages, each with its own dimensions.
The page master set refers to the collection of page masters.
In the following code example, a page master set is defined that contains one
page set:
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
31 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
iii) Page Sequences: <fo:page-sequence>
 A page sequence defines a series of printed pages. Each page sequence refers to a
page master for its dimensions. The page sequence contains the actual content
for the document.
 The <fo:page-sequence> element contains <fo:static-content> and <fo:flow>
elements.
 The <fo:static-content> element is used for page headers and footers. For
example, we can define a header for the company name and page number, and
this information will appear on every page.
 The <fo:flow> element contains a collection of text blocks. The <fo:flow> element
is similar to a collection of paragraphs. A body of text is defined using the
<fo:block> element.
 The <fo:block> element is a child element of <fo:flow>. The <fo:block> element
contains free-flowing text that will wrap to the next line in a document if it
overflows.
3. Tables
XSL-FO has rich support for structuring tabular data. In fact, there are many
similarities between HTML tables and XSL-FO tables. Table lists the HTML table
elements with their corresponding XSL-FO table elements.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
32 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Comparing HTML Table Elements and XSL-FO Table Elements
3.12 PARSING XML USING DOCUMENT OBJECT MODEL (DOM)
Document Object Model provides a mechanism for creating a tree of objects
representing all the elements of the XML document.
1. DOM API
The javax.xml.parsers.DocumentBuilderFactory class be used to get a
DocumentBuilder instance. This DocumentBuidler instance can then be used to
create a Document object that conforms to the DOM Specification.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
33 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
2. Document Object Model - Level 3
Simple XML Document
DOM for Purchase Order
3. DOM Packages
i) org.w3c.dom
This package contains DOM programming interfaces for XML document.
ii) javax.xml.parsers
 This package contains the DocumentBuilderFactory and DocumentBuilder
classes.
 This package contains the ParserConfigurationException class.
4. DOM Interfaces
i) The Node Interface
This interface represents single node (element, attribute, text and others) in the
document tree.
ii) The Document Interface
This interface represents entire XML document.
iii) The Element Interface
This interface represents an element in an XML document.
iv) The Attr Interface
This interface represents an attribute in an element object.
v) Additional Interface
CharacterData, Comment, Text, CDataSection, Entity, Notation, ProcessingInstruction
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
34 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
5. DOM Classes
i) DocumentBuilderFactory Class
This defines a factory API that enables applications to obtain a parser that
produces DOM object trees from XML documents. An application can use the same
instance of the factory to obtain one or more instances of the DocumentBuilder.
ii) DocumentBuilder Class
This defines the API to obtain DOM Document instances from an XML document.
Using this class, an application programmer can obtain Document from XML.
6. Node Types
The following table lists what the nodeName and the nodeValue properties will
return for each node type.
Node Type nodeName returns nodeValue returns
Document #document Null
DocumentFragment #document fragment Null
DocumentType #doctype name Null
EntityReference Entity reference name Null
Element Element name Null
Attr Attribute name Attribute value
ProcessingInstruction Target Content of node
Comment #comment Comment text
Text #text Content of node
CDATASection #cdata-section Content of node
Entity Entity name Null
Notation Notation name Null
7. Node Operations
A number of Node operations are possible
 Creating nodes
 Traversing nodes
 Searching for nodes
 Obtaining node content
 Creating attributes
 Removing and changing nodes
 Inserting nodes
8. Example
DocBuilder.java
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
35 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
36 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
3.13 PARSING XML USING SIMPLE API FOR XML (SAX)
SAX is an interface that allows to write applications to read the data held in an
XML document. It is primarily a Java interface. This is called an event-based interfaces
because the parser notifies the application of the significant events as they occur.
1. SAX Packages
Below is a list of all packages that consists of the classes and interfaces used for
SAX parsing.
org.xml.sax: This package provides the core SAX APIs. Some SAX1 APIs are deprecated
to encourage integration of namespace-awareness into designs of new applications and
into maintenance of existing infrastructure.
org.xml.sax.helpers: This package contains "helper" classes, including support for
bootstrapping SAX-based applications.
org.xml.sax.ext: This package contains interfaces to SAX2 facilities that conformant
SAX drivers do not necessarily support.
2. The Basic Structure
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
37 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
i) Application
The Application is the "main program", ie., the code that written to start the
whole process.
Job of the application
 Instantiating a class that implements the org.xml.sax.XMLReader interface.
 Creating a content handler (by instantiating a class that implements the
org.xml.sax.ContentHandler interface).
 Instructing the parser which content handler to use (by calling the XMLReader's
setContentHandler() method).
 Instructing the parser to start processing a particular input document (by calling
the parse() method of the XMLReader).
ii) XMLReader
The XMLReader is an Interface for reading an XML document using callbacks. It
notifies the content handler of all the interesting things it finds in the document, such as
element start tags and end tags.
iii) Content Handler
The Content Handler is the code that written to process the contents of the
document. It processes these notifications to achieve whatever the application requires.
3. Components of SAX Parser
The basic outline of the SAX parsing APIs are shown on the right side of the above
image. To start the process, an instance of the XMLReaderFactory class is used to
generate an instance of the class.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
38 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
i) XMLReader
 This is an interface for reading an XML document using callbacks. This should be
implemented by the SAX2 driver.
 This interface allows an application to set and query features and properties in
the parser, to register event handlers for document processing and to initiate a
document parse.
 This interface replaces the SAX 1.0 Parser interface.
ii) Content Handler
 This receives notification of the logical content of a document. It is the main
interface that most SAX applications implement.
 If the application needs to be informed of basic parsing events, it implements this
interface and registers an instance with the SAX parser using the
setContentHandler method.
 The parser uses the instance to report basic document-related events, such as
the start and end of elements and character data.
iii) ErrorHandler
 It provides methods such as error, fatalError, and warning which are invoked
in response to various parsing errors.
 The default error handler throws an exception for fatal errors and ignores other
errors.
iv) DTDHandler
It defines methods that can be used while processing a DTD to recognize and act
on declarations for an unparsed entity
v) EntityResolver
The resolveEntity method is invoked when the parser must identify data
identified by a URI, URL or URN. In case of URN, the EntityResolver can use the public
identifier instead of the URL to find document, for example to access a local copy of the
document if one exists.
vi) Attributes
This is an interface for a list of XML attributes. This interface allows access to a
list of attributes in three different ways
 by attribute index
 by Namespace-qualified name
 by qualified (prefixed) name
4. SAX API: Classes & Interfaces
i) org.xml.sax.helpers: DefaultHandler is the default base class for SAX2 event
handlers. This class implements the ContentHandler, ErrorHandler, DTDHandler and
EntityResolver interfaces.
ii) javax.xml.parsers.SAXParser: wraps an XMLReader implementation class
iii) javax.xml.parsers.SAXParseFactory: Defines a factory API that enables
applications to configure and obtain a SAX based parser to parse XML documents.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
39 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
5. Example: using ContentHandler
public class Average extends DefaultHandler
{
public static void main(String argv[])
{
DefaultHandler handler=new Average();
SAXParserFactory factory=SAXParserFactory.newInstance();
factory.setValidating(false);
try
{
out=new OutputStreamWriter(System.out, "UTF8");
SAXParser saxParser=factory.newSAXParser();
saxParser.parse(new File(argv[0], handler);
}
catch(SAXParseException spe) { ..... }
catch(SAXException sxe) { ..... }
catch(IOException ioe) { ..... }
}
3.14 INTEGRATING XML WITH DATABASE
 XML and database integration is important because XML provides a standard
technique to describe data.
 By leveraging XML, a company can convert its existing corporate data into a
format that is consumable by its trading partners.
 XML allows the development team to define a set of custom tags specific to its
industry.
 A trading partner can import the XML data into its system using the given format.
Example: rental_property.xml
<rental_property>
<prop_id>1</prop_id>
<name>The Meadows</name>
<address>
<street>251 Eisenhower Blvd</street>
<city>Houston</city>
<state>TX</state>
<postal_code>77033</postal_code></address>
<square_footage>500.0</square_footage>
<bedrooms>1.0</bedrooms>
<bath>1.0</bath>
<price>600</price>
<contact>
<phone>555-555-1212</phone>
<fax>555-555-1414</fax?
</contact>
</rental_property>
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
40 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
1. XML Database Solutions
A large number of XML database solutions are available, and they generally come
in two flavours: Database mapping and Native XML support.
i) XML Database Mapping
 The first type of XML database solution provides a mapping between the XML
document and the database fields.
 The system dynamically converts SQL result sets to XML documents.
 Depending on the sophistication of the product, it may provide a graphical tool to
map the database fields to the desired XML elements.
XML Database Mapping Products
ii) Native XML Support
The second type of XML database solution actually stores the XML data in the
document in its native format. Each product uses its own proprietary serialization
technique to store the data.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
41 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Native XML Database Products
2. Modeling Databases in XML
In the JAXB framework, we can parse XML documents into a suitable Java object.
This technique is referred to as unmarshaling. The JAXB framework also provides the
capability to generate XML documents from Java objects, which is referred to as
marshaling.
Figure: JAXB marshaling and unmarshaling.
3. JAXB (Java API for XML Binding) Solution
The following steps are followed
1. Review the database schema.
2. Construct the desired XML document.
3. Define a schema for the XML document.
4. Create the JAXB binding schema.
5. Generate the JAXB classes based on the schema.
6. Develop a Data Access Object (DAO).
7. Develop a servlet for HTTP access.
Figure: The Rental Property Application Architecture
4. Defining a Schema for the XML Document
rental_property.dtd
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
42 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
5. Creating the JAXB Binding Schema
rental_property.xjs (for XML Java schema)
6. Generating the JAXB Classes Based on Schemas
Figure: Generating Java classes with the JAXB compiler.
The following files are generated:
 RentalPropertyList.java: This file models the <rental_property_list> element.
 RentalProperty.java: This file models the <rental_property> element.
 Address.java: This file models the <address> subelement.
 Contact.java: This file models the <contact> subelement.
7. Developing a Data Access Object (DAO)
A Data Access Object (DAO) provides access to the backend database. The goal of
the DAO design pattern is to provide a higher level of abstraction for database access.
Figure: Data Access Object design pattern.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
43 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Example:
public class RentalPropertyDAO
{
protected Connection myConn;
public RentalPropertyDAO() throws DAOException
{
this(“sun.jdbc.odbc.JdbOdbcDriver”, ”jdbc:odbc:RentalPropertyDSN”, ”test”, “test”);
}
public RentalPropertyDAO(String driverName, String dbUrl, String user, String pass)
throws DAOException
{
try
{
// Load the driver
log(“Loading driver: “ + driverName);
Class.forName(driverName);
// Get a connection
log(“Connecting to the database: “ + dbUrl);
log(“User id: “ + user);
myConn = DriverManager.getConnection (dbUrl, user, pass);
log(“DB connection successful at “ + new java.util.Date());
}
catch (Exception exc)
{
throw new DAOException(exc);
}
}
…
}
3.15 FORMATTING XML ON WEB
1. A Brief History of DSSSL
2. A Brief History of CSS
3. XML Presentation Using CSS
4. An Overview of XHTML
5. An Overview of XForms
1. A Brief History of DSSSL
 In 1996, ISO approved the final draft of the Document Style Semantics and
Specification Language (DSSSL) for SGML documents.
 DSSSL’s specific purpose is to provide processing instructions for SGML
documents.
 The two main types of instructions that DSSSL provides have to do with
transformations (transforming a SGML document from one structure to another)
and formatting or styles (applying style sheets to SGML documents).
 DSSSL defines syntax for how different elements in a SGML document will be
mapped to formatting objects for display.
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
44 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
DSSSL Style Sheet
2. A Brief History of CSS
 In 1996, about the time the DSSSL standard was being finalized by the ISO, the
W3C organization was finalizing its own style language.
 On December 17, 1996, Cascading Style Sheets Level 1 (CSS1) became an official
W3C recommendation.
 CSS1 was introduced with the intention of separating, as much as possible, the
formatting (visual rendering) from HTML-structured documents.
Simple CSS1 Style Sheet
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
45 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
Very Simple HTML Page
3. XML Presentation Using CSS
 Interestingly enough, CSS actually works better with XML than it does with
HTML.
 This is because XML has none of the problems that CSS was designed to
correct— namely the mingling of data structure and data formatting in HTML.
notestyle.css
Applying CSS to an XML Document
Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3
46 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
4. An Overview of XHTML
Using Hyperlinks and the link Element in XHTML Basic
5. An Overview of XForms
 XForms is the next generation of forms on the Web. Fully XML 1.0 compatible,
XForms will provide a separation of purpose and presentation.
 Also, XForms offers instance data tracking, rich data typing, and validation.
 Although only a working draft now, XForms when completed will offer a great
improvement over current forms technology.
XForms Web Form

Contenu connexe

Tendances

Tendances (20)

FDDI and SONET by Er.Anup-(IOE)
FDDI and SONET  by Er.Anup-(IOE)FDDI and SONET  by Er.Anup-(IOE)
FDDI and SONET by Er.Anup-(IOE)
 
Data models
Data modelsData models
Data models
 
Components of .NET Framework
Components of .NET FrameworkComponents of .NET Framework
Components of .NET Framework
 
Html frames
Html framesHtml frames
Html frames
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
 
Join operation
Join operationJoin operation
Join operation
 
Simple object access protocol(soap )
Simple object access protocol(soap )Simple object access protocol(soap )
Simple object access protocol(soap )
 
Xml web services
Xml web servicesXml web services
Xml web services
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Xslt elements
Xslt elementsXslt elements
Xslt elements
 
XML Databases
XML DatabasesXML Databases
XML Databases
 
Active database
Active databaseActive database
Active database
 
Files
FilesFiles
Files
 
Database schema architecture.ppt
Database schema architecture.pptDatabase schema architecture.ppt
Database schema architecture.ppt
 
ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And Representation
 
Database User and Administrator
Database User and AdministratorDatabase User and Administrator
Database User and Administrator
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Xml schema
Xml schemaXml schema
Xml schema
 

Similaire à XML

IT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureIT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureMadhu Amarnath
 
Effective Data Retrieval in XML using TreeMatch Algorithm
Effective Data Retrieval in XML using TreeMatch AlgorithmEffective Data Retrieval in XML using TreeMatch Algorithm
Effective Data Retrieval in XML using TreeMatch AlgorithmIRJET Journal
 
XML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGS
XML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGSXML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGS
XML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGSijdms
 
A Survey on Heterogeneous Data Exchange using Xml
A Survey on Heterogeneous Data Exchange using XmlA Survey on Heterogeneous Data Exchange using Xml
A Survey on Heterogeneous Data Exchange using XmlIRJET Journal
 
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27Max Kleiner
 
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xml
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xmlXml theory 2005_[ngohaianh.info]_1_introduction-to-xml
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xmlÔng Thông
 
RELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULESRELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULESijwscjournal
 
RELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULESRELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULESijwscjournal
 
Bt0078 website design
Bt0078   website designBt0078   website design
Bt0078 website designsmumbahelp
 
Enhanced xml validation using srml01
Enhanced xml validation using srml01Enhanced xml validation using srml01
Enhanced xml validation using srml01IJwest
 
D0373024030
D0373024030D0373024030
D0373024030theijes
 
INVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTS
INVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTSINVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTS
INVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTScsandit
 
XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7Deniz Kılınç
 
Running Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docx
Running Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docxRunning Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docx
Running Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docxtodd521
 

Similaire à XML (20)

5010
50105010
5010
 
IT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureIT6801-Service Oriented Architecture
IT6801-Service Oriented Architecture
 
Effective Data Retrieval in XML using TreeMatch Algorithm
Effective Data Retrieval in XML using TreeMatch AlgorithmEffective Data Retrieval in XML using TreeMatch Algorithm
Effective Data Retrieval in XML using TreeMatch Algorithm
 
XML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGS
XML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGSXML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGS
XML COMPACTION IMPROVEMENTS BASED ON BINARY STRING ENCODINGS
 
A Survey on Heterogeneous Data Exchange using Xml
A Survey on Heterogeneous Data Exchange using XmlA Survey on Heterogeneous Data Exchange using Xml
A Survey on Heterogeneous Data Exchange using Xml
 
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27
 
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xml
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xmlXml theory 2005_[ngohaianh.info]_1_introduction-to-xml
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xml
 
RELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULESRELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULES
 
RELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULESRELATIONAL STORAGE FOR XML RULES
RELATIONAL STORAGE FOR XML RULES
 
Bt0078 website design
Bt0078   website designBt0078   website design
Bt0078 website design
 
Enhanced xml validation using srml01
Enhanced xml validation using srml01Enhanced xml validation using srml01
Enhanced xml validation using srml01
 
E05412327
E05412327E05412327
E05412327
 
D0373024030
D0373024030D0373024030
D0373024030
 
INVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTS
INVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTSINVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTS
INVESTIGATING BINARY STRING ENCODING FOR COMPACT REPRESENTATION OF XML DOCUMENTS
 
XML-Unit 1.ppt
XML-Unit 1.pptXML-Unit 1.ppt
XML-Unit 1.ppt
 
A survey of xml tree patterns
A survey of xml tree patternsA survey of xml tree patterns
A survey of xml tree patterns
 
XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7
 
Unit 3 WEB TECHNOLOGIES
Unit 3 WEB TECHNOLOGIES Unit 3 WEB TECHNOLOGIES
Unit 3 WEB TECHNOLOGIES
 
Running Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docx
Running Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docxRunning Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docx
Running Head THE SEVEN LAYER MODEL OF OSIKao 1THE SEVEN LAYE.docx
 
Full xml
Full xmlFull xml
Full xml
 

Plus de Prabu U

Computation Using Scipy, Scikit Image, Scikit Learn
Computation Using Scipy, Scikit Image, Scikit LearnComputation Using Scipy, Scikit Image, Scikit Learn
Computation Using Scipy, Scikit Image, Scikit LearnPrabu U
 
Concurrency and Parallelism, Asynchronous Programming, Network Programming
Concurrency and Parallelism, Asynchronous Programming, Network ProgrammingConcurrency and Parallelism, Asynchronous Programming, Network Programming
Concurrency and Parallelism, Asynchronous Programming, Network ProgrammingPrabu U
 
File Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with PandasFile Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with PandasPrabu U
 
Arrays with Numpy, Computer Graphics
Arrays with Numpy, Computer GraphicsArrays with Numpy, Computer Graphics
Arrays with Numpy, Computer GraphicsPrabu U
 
Lambdas, Collections Framework, Stream API
Lambdas, Collections Framework, Stream APILambdas, Collections Framework, Stream API
Lambdas, Collections Framework, Stream APIPrabu U
 
Exception handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread ProgrammingException handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread ProgrammingPrabu U
 
String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesPrabu U
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and ObjectsPrabu U
 
Building XML Based Applications
Building XML Based ApplicationsBuilding XML Based Applications
Building XML Based ApplicationsPrabu U
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XMLPrabu U
 
WEB SERVICES
WEB SERVICESWEB SERVICES
WEB SERVICESPrabu U
 
SERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMINGSERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMINGPrabu U
 
Internet Principles and Components, Client-Side Programming
Internet Principles and Components, Client-Side ProgrammingInternet Principles and Components, Client-Side Programming
Internet Principles and Components, Client-Side ProgrammingPrabu U
 
Operation Management
Operation ManagementOperation Management
Operation ManagementPrabu U
 
Nature and Importance of Management
Nature and Importance of ManagementNature and Importance of Management
Nature and Importance of ManagementPrabu U
 
Replacement and Maintenance Analysis
Replacement and Maintenance AnalysisReplacement and Maintenance Analysis
Replacement and Maintenance AnalysisPrabu U
 
Elementary Economic Analysis
Elementary Economic AnalysisElementary Economic Analysis
Elementary Economic AnalysisPrabu U
 
Introduction to Engineering Economics
Introduction to Engineering EconomicsIntroduction to Engineering Economics
Introduction to Engineering EconomicsPrabu U
 
Files in C
Files in CFiles in C
Files in CPrabu U
 
Structures and Pointers
Structures and PointersStructures and Pointers
Structures and PointersPrabu U
 

Plus de Prabu U (20)

Computation Using Scipy, Scikit Image, Scikit Learn
Computation Using Scipy, Scikit Image, Scikit LearnComputation Using Scipy, Scikit Image, Scikit Learn
Computation Using Scipy, Scikit Image, Scikit Learn
 
Concurrency and Parallelism, Asynchronous Programming, Network Programming
Concurrency and Parallelism, Asynchronous Programming, Network ProgrammingConcurrency and Parallelism, Asynchronous Programming, Network Programming
Concurrency and Parallelism, Asynchronous Programming, Network Programming
 
File Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with PandasFile Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with Pandas
 
Arrays with Numpy, Computer Graphics
Arrays with Numpy, Computer GraphicsArrays with Numpy, Computer Graphics
Arrays with Numpy, Computer Graphics
 
Lambdas, Collections Framework, Stream API
Lambdas, Collections Framework, Stream APILambdas, Collections Framework, Stream API
Lambdas, Collections Framework, Stream API
 
Exception handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread ProgrammingException handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread Programming
 
String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and Interfaces
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
Building XML Based Applications
Building XML Based ApplicationsBuilding XML Based Applications
Building XML Based Applications
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
WEB SERVICES
WEB SERVICESWEB SERVICES
WEB SERVICES
 
SERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMINGSERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMING
 
Internet Principles and Components, Client-Side Programming
Internet Principles and Components, Client-Side ProgrammingInternet Principles and Components, Client-Side Programming
Internet Principles and Components, Client-Side Programming
 
Operation Management
Operation ManagementOperation Management
Operation Management
 
Nature and Importance of Management
Nature and Importance of ManagementNature and Importance of Management
Nature and Importance of Management
 
Replacement and Maintenance Analysis
Replacement and Maintenance AnalysisReplacement and Maintenance Analysis
Replacement and Maintenance Analysis
 
Elementary Economic Analysis
Elementary Economic AnalysisElementary Economic Analysis
Elementary Economic Analysis
 
Introduction to Engineering Economics
Introduction to Engineering EconomicsIntroduction to Engineering Economics
Introduction to Engineering Economics
 
Files in C
Files in CFiles in C
Files in C
 
Structures and Pointers
Structures and PointersStructures and Pointers
Structures and Pointers
 

Dernier

A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptxrouholahahmadi9876
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 

Dernier (20)

A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 

XML

  • 1. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 1 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | UNIT III XML XML: Introduction- Revolutions of XML-XML Basics Defining XML Documents: DTD-XML Schema-Namespaces XFiles: XLink – XPointer - XPath XSL Technologies: XML with XSL (XSLT)– XSL-FO Parsing XML using DOM - SAX - Integrating XML with database Formatting XML on the web. XML 3.1 INTRODUCTION  XML, the eXtensible Markup Language, is best described as a means of structuring data.  XML provides rules for placing text and other media into structures and allows you to manage and manipulate the results.  The XML standard is a subset of the Standard Generalized Markup Language (SGML), and was developed in 1996 by the SGML Editorial Review Board under the auspices of World Wide Web Consortium (W3C).  XML is designed for that express purpose. XML provides a mechanism for the interchange of Structured information on the web.  This sort of data is required to transform the web from a publishing media to an application processing environment. XML Design Goals The design goals for XML were proposed by the World Wide Web Consortium (W3C) and published in January 1998. The usage of XML was aimed at  Should be usable over the internet  Should support a wide variety of applications  Should be compatible with SGML and XML documents should be easy to create Also XML can be used for  Data Exchange  Store and Retrieve Data The Role of XML  XML was created to structure, store and transport information. It is just plain text.  Software that can handle plain text can also handle XML.  It is the most common tool for data transmissions between all sort of applications, and is popular in the area of storing and describing information Some Examples: Books, Financial transactions (EDI), Technical manuals, Chemical formulae, Medical records, Museum catalog records, Encyclopaedia entries.
  • 2. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 2 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 3.2 REVOLUTIONS OF XML 1. The Data Revolution  XML's strength is its data independence. XML is pure data description, not tied to any programming language, operating system, or transport protocol.  XML's sole focus on data means that a variety of transport technologies may be used to move XML across the Web.  As a result, protocols such as HTTP have had a tremendous impact on XML's viability and have opened the door to alternatives to CORBA, RMI, and DCOM, which don't work over TCP/IP.  XML does this by focusing on data and leaving other issues to supporting technologies Figure: The Data Revolution 2. The Architectural Revolution  The focal point of this change in architectural thinking has been a move from tightly coupled systems based on established infrastructures such as CORBA, RMI, and DCOM, each with their own transport protocol, to loosely coupled systems riding atop standard Web protocols such as TCP/IP.  Although the transport protocols underlying CORBA, RMI, and DCOM provide for efficient communication between nodes, their drawback is their inability to communicate with other tightly coupled systems or directly with the Web.  Loosely coupled Web-based systems, on the other hand, provide what has long been considered the Holy Grail of computing: universal connectivity.  Using TCP/IP as the transport, systems can establish connections with each other using common open-Web protocols.
  • 3. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 3 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |  Although it is possible to build software bridges linking tightly coupled systems with each other and the Web, such efforts are not trivial and add another layer of complexity on top of an already complex infrastructure. Figure: The Architectural Revolution 3. The Software Revolution  XML is also part of a revolution in how we build software. During the 1970s and 1980s, software was constructed as monolithic applications built to solve specific problems.  The problem with large software projects is that, by trying to tackle multiple problems at once, the software is often ill-suited to adding new functionality and adapting to technological change.  In the 1990s a different model for software emerged based on the concept of simplicity.  As Figure illustrates, instead of trying to define all requirements up front, this new philosophy was built around the concept of creating building blocks capable of combination with other building blocks that either already existed or were yet to be created.
  • 4. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 4 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Figure: The Software Revolution 3.3 XML BASICS 1. XML Delimiter Characters  Markup text has a couple rules.  First, it needs to be differentiated from the rest of the document text by a unique set of characters that delineates where the markup information starts and ends.  These special characters are known as delimiters. The XML language has four special delimiters 2. A Simple XML Document
  • 5. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 5 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 3. XML Declaration  The XML declaration is a processing instruction of the form <?xml ...?>.  The XML declaration indicates the presence of external markup declarations and character encoding.  The XML declaration consists of a number of components. 4. Document Type Declaration  The Document Type Declaration (DOCTYPE) gives a name to the XML content and provides a means to guarantee the document’s validity, either by including or specifying a link to a Document Type Definition (DTD).  The keyword NAME should be replaced with the actual root element contained in the document, and the “file” keyword should be replaced with a path to a valid DTD.  In the case of our shirt example, the DOCTYPE is <!DOCTYPE shirt SYSTEM “shirt.dtd”>
  • 6. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 6 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 5. Attributes Within elements, additional information can be communicated to XML processors that modifies the nature of the encapsulated content. For example, we may have specified a <price> element, but how do we know what currency this applies to? DEFINING XML DOCUMENTS 3.4 DOCUMENTS TYPE DEFINITIONS  DTD stands for Document Type Definition. A Document Type Definition allows the XML author to define a set of rules for an XML document to make it valid.  An XML document is considered “well formed” if that document is syntactically correct according to the syntax rules of XML 1.0. Some Simple DTD Examples An Internal DTD An External DTD
  • 7. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 7 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 1. DTD Elements  All elements in a valid XML document are defined with an element declaration in the DTD.  An element declaration defines the name and all allowed contents of an element.  Element names must start with a letter or an underscore and may contain any combination of letters, numbers, underscores, dashes, and periods.  Element names must never start with the string “xml”.  Colons should not be used in element names because they are normally used to reference namespaces. Each element in the DTD should be defined with the following syntax: <!ELEMENT elementname rule >  ELEMENT is the tag name that specifies that this is an element definition.  elementname is the name of the element.  rule is the definition to which the element’s data content must conform. contactlist.dtd contactlist.xml 2. DTD Element Rules  All data contained in an element must follow a set rule.  The rule is the definition to which the element’s data content must conform.  There are two basic types of rules that elements must fall into.  The first type of rule deals with content. The second type of rule deals with structure. i) Content Rules  The content rules for .elements deal with the actual data that defined elements may contain.  These rules include the ANY rule, the EMPTY rule, and the #PCDATA rule.
  • 8. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 8 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | a) The ANY Rule An element may be defined. using the ANY rule. The element may contain other elements and/or normal character data. An element using the ANY rule would appear as follows: <!ELEMENT elementname ANY> XML Fragments Using the ANY Rule b) The EMPTY Rule This rule is the exact opposite of the ANY rule. An element that is defined with this rule will contain no data. However, an element with the EMPTY rule could still contain attributes (more on attributes in a bit). The following element is an example of the EMPTY rule: <!ELEMENT elementname EMPTY> c) The #PCDATA Rule  The #PCDATA rule indicates that parsed character data will be contained in the element.  Parsed character data is data that may contain normal markup and will be interpreted and parsed by any XML parser accessing the document. The following element demonstrates the #PCDATA rule: <!ELEMENT elementname (#PCDATA)> ii) Structure Rules  Whereas the content rules. deal with the actual content of the data contained in defined elements, structure rules deal with how that data may be organized.  There are two types of structure rules. The first is the “element only” rule. The second rule is the “mixed” rule. a) The “Element Only” Rule  The “element only” rule .specifies that only elements may appear as children of the current element.  The child element sequences should be separated by commas and listed in the order they should appear.
  • 9. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 9 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |  If there are to be options for which elements will appear, the listed elements should be separated by the pipe symbol (|). The following element definition demonstrates the “element only” rule: <!ELEMENT elementname (element1, element2, element3)> b) The “Mixed” Rule  The “mixed” rule is used to help define elements that may have both character data (#PCDATA) and child elements in the data they contain.  A list of options or a sequential list will be enclosed by parentheses. Options will be separated by the pipe symbol (|), whereas sequential lists will be separated by commas. The following element is an example of the “mixed” rule: <!ELEMENT elementname (#PCDATA | childelement1 | childelement2)*> 3. DTD Attributes Attribute list declarations in a DTD will have the following syntax: <!ATTLIST elementname attributename type defaultbehavior defaultvalue>  ATTLIST is the tag name that specifies that this definition will be for an attribute list.  elementname is the name of the element that the attribute will be attached to.  attributename is the actual name of the attribute.  type indicates which of the 10 valid kinds of attributes this attribute definition will be.  defaultbehavior dictates whether the attribute will be required, optional, or fixed in value. This setting determines how a validating parser should relate to this attribute.  defaultvalue is the value of the attribute if no value is explicitly set. 4. DTD Entities  Entities in DTDs are storage units. They can also be considered placeholders.  Entities are special markups that contain content for insertion into the XML document. The general syntax of an entity is as follows: <!ENTITY entityname [SYSTEM | PUBLIC] entitycontent>  ENTITY is the tag name that specifies that this definition will be for an entity.  entityname is the name by which the entity will be referred in the XML document.  entitycontent is the actual contents of the entity—the data for which the entity is  serving as a placeholder.  SYSTEM and PUBLIC are optional keywords. Either one can be added to the definition of an entity to indicate that the entity refers to external content. i) External Entities  External entities are used to reference external content. External entities get their content by referencing it via a URL placed in the entitycontent portion of the entity declaration.  Either the SYSTEM keyword or the PUBLIC keyword is used here to let the XML parser know that the content is external.
  • 10. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 10 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | ii) Parameter Entities Parameter entities can be useful when you have to use a lot of repetitive or lengthy text in a DTD. Use the following syntax for parameter entities: <!ENTITY % entityname entitycontent> 5. More DTD Directives i) The IGNORE Keyword  When developing or updating a DTD, you may need to comment out parts of the DTD that are not yet reflected in the XML documents that use the DTD.  You could use a normal comment directive, or you can use an IGNORE directive. The syntax for IGNORE <![ IGNORE This is the part of the DTD ignored ]]> Example <!ELEMENT Employee <![ IGNORE (#PCDATA) ]]> (Name, Address, Phone) > ii) The INCLUDE Keyword The INCLUDE directive marks declarations to be included in the document. <![ INCLUDE This is the part of the DTD included ]]> iii) Comments Within a DTD Comments can also be added to DTDs. Comments within a DTD are just like comments in HTML and take the following syntax: <!-- Everything between the opening tag and closing tag is a comment --> 6. Drawbacks of DTD  Use of non-XML syntax.  No support for data typing.  Non-extensibility. 3.5 XML SCHEMA  The XML Schema Definition Language is an XML language for describing and constraining the content of XML documents.  XML Schema is a W3C recommendation.  XML Schema defines what it means for an XML document to be valid.  XML Schema are a radical departure from Document Type Definitions (DTDs), the existing schema mechanism inherited from SGML. 1. Usage of XML Schemas  It support data types.  It uses XML syntax.  It has secure data communication.  XML Schemas are extensible.  When using XML Schemas most of the errors can be taken care of by the validating software.
  • 11. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 11 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 2. XML Schema Definition  Elements that can appear in a document.  Attributes that can appear in a document.  The elements that are child elements.  The order of child elements.  The number of child elements.  The criteria whether an element is empty or can include text.  Data types for elements and attributes.  Default and fixed values for elements and attributes. 3. XML Schema Data Types XSD String: String data types are used for values that contains character strings. XSD Date: Date and time data types are used for values that contain date and time. XSD Numeric: Numeric data types are used for numeric values. XSD Misc: Other miscellaneous data types like boolean, base64Binary, hexBinary, float, double etc. 4. Types of Indicators i) Order indicators a) All Indicator The <all> indicator specifies, by default, that the child elements can appear in any order and that each child element must occur once and only once. <xs:element name="book"> <xs:complexType> <xs:all> <xs:element name="title" type="xs:string"/> <xs:element name="author" type="xs:string"/> </xs:all> </xs:complexType> </xs:element> b)Choice Indicator The <choice> indicator specifies that either one child element or another can occur. <xs:element name="person"> <xs:complexType> <xs:choice> <xs:element name="employee" type="employee"/> <xs:element name="member" type="member"/> </xs:choice> </xs:complexType> </xs:element> c) Sequence Indicator The <sequence> indicator specifies that the child elements must appear in a specific order. <xs:element name="book"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/>
  • 12. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 12 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | <xs:element name="author" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> ii) Occurrence Indicators Occurrence indicators are used to define how often an element can occur. For Order and group indicators, the default value for maxOccurs and minOccurs is 1. The <maxOccurs> indicator specifies the maximum number of times an element can occur. The <minOccurs> indicator specifies the minimum number of times an element can occur. <xs:element name="book"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="author" type="xs:string"/> <xs:element name="vendor" type="xs:string" maxOccurs="2" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> iii) Group Indicators Group indicators are used to define related sets of elements. Element groups are defined with group declaration. <xs:group name="persongroup"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lasstname" type="xs:string"/> <xs:element name="birthday" type="xs:string"/> </xs:sequence> </xs:group> <xs:element name="person" type="personinfo"/> <xs:complexType name="personinfo"> <xs:sequence> <xs:group ref="persongroup"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> EXAMPLE FOR XML SCHEMA companyschema.xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="employees"> <xs:complexType>
  • 13. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 13 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | <xs:sequence> <xs:element maxOccurs="unbounded" name="employee"> <xs:complexType> <xs:sequence> <xs:element name="Name" type="xs:string" /> <xs:element name="Salary" type="xs:unsignedShort" /> <xs:element name="ProId" type="xs:unsignedByte" /> <xs:element name="ProName" type="xs:string" /> <xs:element name="SBUName" type="xs:string" /> <xs:element name="SBULoc" type="xs:string" /> </xs:sequence> <xs:attribute name="code" type="xs:unsignedByte" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> companyschema.xml <?xml version="1.0" encoding="utf-8"?> <employees> <employee code="001"> <Name>Arun</Name> <Salary>20000</Salary> <ProId>101</ProId> <ProName>Mainframe</ProName> <SBUName>Programmer</SBUName> <SBULoc>Chennai</SBULoc> </employee> </employees> 3.6 NAMESPACES As it is possible for using the same name in different contexts, it is quite possible for XML documents to use an element name for specifying different things. This would cause a name conflict when one wants to merge these documents. Sample 1 (Name Conflict) <word> <head> Ethic </head> <definition> Rules of behaviour based on ideas </definition> </word> Sample 2 (Name Conflict) <word> <filename> test.doc </filename> <category> Technical Report 1 </category> </word>
  • 14. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 14 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | The reason for the conflict is because the element "word" has been defined in two different ways in these documents, where neither their sub-elements names or their contents match. If one tries to merge these two documents, they would receive an error indicating that a name conflict has happened that cannot be resolved. In order to resolve these kind of conflicts, XML uses a mechanism that is called namespace. A namespace is simply a label to an environment, including addresses, module names, file names, file locations, and such, within which a "name" is unique. Namespace allows programmers to make sure that certain names are unique across an application and not just in a single program. A namespace allows programmers to define a set of names without any ambiguity. 1. Name Conflict Resolution using a Prefix A straightforward method to resolve naming conflict is to use a prefix to the names. For example we can use two prefixes for the previous examples to avoid name conflict. Sample 1 (using prefix for Name Conflict resolution) <dic:word> <head> Ethic </head> <definition> Rules of behaviour based on ideas </definition> </dic:word> Sample 2 (using prefix for Name Conflict resolution) <proc:word> <filename> test.doc </filename> <category> Technical Report 1 </category> </proc:word> The prefixes "dic" and "proc" now qualify the words, providing two new names that are different from each other, hence they have no conflict any more. 2. XML Namespace In XML the namespace is defined by using an attribute that is called xmlns. The main rules for XML namespace definition are  The value of the attribute specifies the location that the namespace could be found.  The namespace attribute can appear in the start-tag of an element, in which case all children of that element would be associated to the same namespace.  The namespace can appear in the root element, in which case the whole document would be associated to the defined namespace.  As xmlns is an attribute, it can have several prefixes making each one unique, hence it is possible to define several namespace within a tag.  The children (sub-elements) should be prefixed by the defined prefix.
  • 15. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 15 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Syntax: xmlns:prefix="URI" prefix: is any valid string URI: is an abbreviation for "Uniform Resource Identifier", which must be a valid Internet Resource. Example: xmlns="http://www.w3.org/HTML/1998/html4" 3. Default Namespace A useful way to avoid repeating prefixes in front of every child element is to define a default namespace. Default namespace does not have any prefix. Syntax: xmlns:="URI" prefix: is any valid string URI: is an abbreviation for "Uniform Resource Identifier", which must be a valid Internet Resource. Example: xmlns="http://www.w3.org/1999/xhtml" XFILES 3.7 XLINK The XML Linking Language, XLink, addresses and overcomes the limitations of anchor element, <a> in HTML by allowing a link to another document to be specified on any element within an XML document. The XML Linking Language creates a link to another resource through the use of attributes specified on elements, not through the actual elements themselves. XLink Attributes 1. xlink:type This attribute must be specified and indicates what type of XLink is represented or defined. The xlink:type attribute must contain one of the following values: i) Simple A value of simple creates a simple link between resources. Indicating a value of extended creates an extended link. ii) Locator A value of locator creates a link that points to another resource. iii) Arc A value of arc creates an arc with multiple resources and various traversal paths. iv) Resource A resource value creates a link to indicate a specific resource. v) Title A value of title creates a title link. vi) None For all intents and purposes, a value of none removes the ability to link to another resource from an element.
  • 16. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 16 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 2. xlink:role The xlink:role attribute specifies the function of the link. However, you cannot use this attribute with just any type of XLink. This attribute may only be used for the following XLink types:  extended  simple  locator  resource 3. xlink:arcrole The xlink:arcrole attribute may only be used with two types of XLinks:  arc  simple 4. xlink:title The xlink:title attribute is completely optional and is provided for us to make some sense of and document, in a way, what a particular link is. If the xlink:title attribute is specified, it should contain a string describing the resource. 5. xlink:show The xlink:show attribute is an optionally specified attribute for a link for the simple and arc XLink types and will accept the following values:  new  replace  embed  other  none 6. xlink:actuate The xlink:actuate attribute is used to indicate when the linked resource should be loaded. This attribute will accept the following values:  onLoad  onRequest  other  none 7. xlink:label The xlink:label attribute is used to name resource and locator XLink types. This value will end up being used as values within the xlink:from and xlink:to attributes to indicate the starting and ending resources for an arc XLink type.
  • 17. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 17 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Example: Sample3.xml
  • 18. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 18 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 3.8 XPOINTER An XPointer describes a location within an external document, an XPointer can target a point within that XML document or a range within the target XML document.  XPointer provides two more important node tests:  point()  range() The XPointer specification also adds an additional function named unique(). This new function indicates whether an XPointer expression selects a single location rather than multiple locations or no locations at all. For an XPointer expression, the result is known as a location set. Some XPointer Functions That Return Location Sets 1. Points Two different types of points can be represented using XPointer points:  Node points  Character points i) Node Point  Node points are location points in an XML document that are nodes that contain child nodes.  For these node points, the index position indicates after which child node to navigate to.  If 0 is specified for the index, the point is considered to be immediately before any child nodes.  A node point could be considered to be the gap between the child nodes of a container node. ii) Character Point  When the origin node is a text node, the index position indicates the number of characters. These location points are referred to as character points.  Because you are indicating the number of characters from the origin, the index specified must be an integer greater than or equal to 0 and less than or equal to the total length of the text within the text node.  By specifying 0 for the index position in a character point, the point is considered to be immediately before the first character in the text string.  For a character point, the point, conceptually, represents the space between the characters of a text string.
  • 19. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 19 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Example <People> <Person> <Name>Dillon Larsen</Name> <Address> <Street>123 Jones Rd.</Street> <City>Houston</City> <State>TX</State> <Zip>77380</Zip> </Address> </Person> <Person> <Name>Madi Larsen</Name> <Address> <Street>456 Hickory Ln.</Street> <City>Houston</City> <State>TX</State> <Zip>77069</Zip> </Address> </Person> </People> Examples of XPointer Points and the Resulting Locations 2. Ranges  An XPointer range defines just that—a range consisting of a start point and an endpoint.  A range will contain the XML between the start point and endpoint but does not necessarily have to consist of neat subtrees of an XML document.  A range can extend over multiple branches of an XML document.  The only criterion is that the start point and endpoint must be valid. The general syntax for string-range() is as follows: string-range(location-set, string, [index, [length]])
  • 20. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 20 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | XPointer Range Functions 3.9 XPATH  The XML Path Language (XPath) is a standard for creating expressions that can be used to find specific pieces of information within an XML document.  XPath expressions are used by both XSLT (for which XPath provides the core functionality) and XPointer to locate a set of nodes.  XPath expressions have the ability to locate nodes based on the node's type, name, or value or by the relationship of the nodes to other nodes within the XML document.  An XPath expression can also return any of the following:  A node set  A Boolean value  A string value  A numeric value 1. Operators and Special Characters  XPath expressions are composed using a set of operators and special characters, each with its own meaning.  The various operators and special characters used within the XML Path Language are listed below.
  • 21. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 21 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | The priority for evaluating XPath expressions is as follows: 1. Grouping 2. Filters 3. Path operations 2. XPath Syntax  The XML Path Language provides a declarative notation, termed a pattern, used to select the desired set of nodes from XML documents.  Each pattern describes a set of matching nodes to select from a hierarchical XML document.  A location path is, itself, made up of one or more location steps. Each step is further comprised of three pieces:  An axis  A node test  A predicate  Therefore, the basic syntax for an XPath expression axis::node test[predicate] i) Axes The axis portion of the location step identifies the hierarchical relationship for the desired nodes from the current context. An axis for a location step could be any of the items below. XPath Axes for a Location Step
  • 22. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 22 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | ii) A Node Test  The node test portion of a location step indicates the type of node desired for the results.  Every axis has a principal node type: If an axis is an element, the principal node type is element; otherwise, it is the type of node the axis can contain.  For instance, if the axis is attribute, the principal node type is attribute. In addition to specifying an actual node name, other node tests are available to select the desired nodes. Here’s a list of these node tests:  comment()  node()  processing-instruction()  text() iii) Predicates  The predicate portion of a location step filters a node set on the specified axis to create a new node set.  Each node in the preliminary node set is evaluated against the predicate to see whether it matches the filter criteria.  If it does, the node ends up in the filtered node set. Otherwise, it doesn’t. 3. XPath Functions XPath functions are used to evaluate XPath expressions and can be divided into one of four main groups:  Boolean  Node set  Number  String
  • 23. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 23 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 4. XPath Examples
  • 24. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 24 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | XSL TECHNOLOGIES XML Stylesheet Language (XSL) has two independent languages:  The XSL Transformation Language (XSLT)  The XSL Formatting Object Language (XSL-FO) 3.10 XML WITH XSL (XSLT) XSLT is used to convert an XML document to another format. 1. XSLT for Document Publishing  XSL technology has an important role in the field of document publishing. Imagine, for example, that we have an XML document for a list of books.  We would like to publish this document in various formats. Using XSL, we can convert the book list to an HTML file, PDF document, or other format.  The key to this example is the XML document, which serves as a single data source. By applying an XSL style sheet, we render a new view of the data. Figure: Publishing documents with XSLT.
  • 25. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 25 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Figure: Sending data to the XSLT processor. 2. Getting Started with XSLT i) Creating the XML Document The XML document, book.xml, contains elements for the author, title, price, summary, and category. ii) Creating the XSL Style Sheet  The next step is to create the XSL style sheet. XSL style sheets are XML documents; as a result, they must be well formed.  The <xsl:stylesheet> element defines how the XSLT processor should process the current XSL document. The xmlns attribute is the namespace definition.
  • 26. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 26 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 3. The XSLT Processor 4. Implementing Client-Side XSLT Processing  For client-side processing, the XML document requires a special processing instruction to reference the XSL style sheet.  The processing instruction is <?xml-stylesheet>, and it has two attributes: type and href.  The type attribute specifies the content type of the document to be retrieved (in this case, text/xsl).  The href attribute is a URL reference to the style sheet. book.xml book_view.xsl
  • 27. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 27 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 5. Implementing Server-Side XSLT Processing i) ASP: Server-Side XSLT Processing In order to develop using ASP, you will need the IIS Web server and the latest version of the Microsoft XML parser. The required components are listed below.: Microsoft IIS Web Server 5.0: This version of IIS is included with Microsoft Windows 2000 Professional. You can also use IIS 4.0 or Personal Web Server (PWS); however, you will have to install the Windows NT Option Pack 4. Microsoft XML Parser 3.0: If you have IE 6 installed on your server machine, then MS XML Parser 3.0 is included. The MS XML Parser 3.0 is also available as a separate download from http://msdn.microsoft.com. book_test.asp ii) JSP: Server-Side XSLT Processing Sun Microsystems’ Software Development Kit (SDK) 1.3 (or higher):. The SDK is available at Sun’s Web site, http://java.sun.com/j2se. Follow the installation instructions provided with the SDK. Apache Tomcat Server 4: Apache Tomcat 4 is the official reference implementation for JSP 1.2 and Java Servlets 2.3. If your application server already supports JSP 1.1 or higher, there is no requirement to install Tomcat. Apache Tomcat 4 is available from the Apache Web site, http://jakarta.apache.org/tomcat. Follow the installation instructions provided with the Tomcat server. book_test.jsp 6. Advanced Features of XSLT i) Looping  The XSLT element <xsl: for-each> is used for looping through a list of elements.  The <xsl: for-each> element is commonly used in the Web development world to convert an XML document to an HTML table. booklist_loop.xsl
  • 28. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 28 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | ii) Sorting In XSLT, the <xsl:sort> element is used for sorting the XML data. It is possible to sort based on a single key or multiple keys. The syntax for the <xsl:sort> element is shown here: <xsl:sort select = string-expression order = { “ascending” | “descending” } data-type = { “text” | “number” } case-order = {“upper-first” | “lower-first” } lang = { nmtoken } /> booklist_sort.xsl iii) Conditionals During an XSLT transformation, the style sheet can perform conditional tests on the data. XSLT contains a very simple if-then conditional. iv) Filters  In relation to conditional tests, XSLT can also filter the data based on a given expression.  When data is selected using the <xsl: for-each> element, the expression can contain a filter.  For example, you can filter the data to contain only Java books.  The following code snippet performs the desired operation:
  • 29. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 29 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 3.11 XSL FORMATTING OBJECTS (XSL-FO) The XSL technology is also composed of XSL Formatting Objects (XSL-FO). XSL- FO was designed to assist with the printing and displaying of XML data. The main emphasis is on the document layout and structure. 1. XSL-FO Formatting Engines 2. Basic Document Structure  An XML-FO document follows the syntax rules of XML; as a result, it is well formed.  XSL-FO elements use the following namespace: http://www.w3.org/1999/XSL/Format  The following code snippet shows the basic document setup for XSL-FO: <?xml version=”1.0” encoding=”utf-8”?> <fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”> <!-- layout master set --> <!-- page masters: size and layout --> <!-- page sequences and content --> </fo:root>  The element <fo:root> is the root element for the XSL-FO document. An XSL-FO document can contain the following components:  Page master  Page master set  Page sequences i) Page Master: <fo:page-master> The page master describes the page size and layout. The page master contains the dimensions for a page, including width, height, and margins. The <fo:simple-page-master> element defines the layout of a page. The following code snippet describes a U.S. letter:
  • 30. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 30 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Figure: Components of a Page Master XSL-FO Dimensions ii) Page Master Set: <fo:page-master-set> A document can be composed of multiple pages, each with its own dimensions. The page master set refers to the collection of page masters. In the following code example, a page master set is defined that contains one page set:
  • 31. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 31 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | iii) Page Sequences: <fo:page-sequence>  A page sequence defines a series of printed pages. Each page sequence refers to a page master for its dimensions. The page sequence contains the actual content for the document.  The <fo:page-sequence> element contains <fo:static-content> and <fo:flow> elements.  The <fo:static-content> element is used for page headers and footers. For example, we can define a header for the company name and page number, and this information will appear on every page.  The <fo:flow> element contains a collection of text blocks. The <fo:flow> element is similar to a collection of paragraphs. A body of text is defined using the <fo:block> element.  The <fo:block> element is a child element of <fo:flow>. The <fo:block> element contains free-flowing text that will wrap to the next line in a document if it overflows. 3. Tables XSL-FO has rich support for structuring tabular data. In fact, there are many similarities between HTML tables and XSL-FO tables. Table lists the HTML table elements with their corresponding XSL-FO table elements.
  • 32. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 32 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Comparing HTML Table Elements and XSL-FO Table Elements 3.12 PARSING XML USING DOCUMENT OBJECT MODEL (DOM) Document Object Model provides a mechanism for creating a tree of objects representing all the elements of the XML document. 1. DOM API The javax.xml.parsers.DocumentBuilderFactory class be used to get a DocumentBuilder instance. This DocumentBuidler instance can then be used to create a Document object that conforms to the DOM Specification.
  • 33. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 33 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 2. Document Object Model - Level 3 Simple XML Document DOM for Purchase Order 3. DOM Packages i) org.w3c.dom This package contains DOM programming interfaces for XML document. ii) javax.xml.parsers  This package contains the DocumentBuilderFactory and DocumentBuilder classes.  This package contains the ParserConfigurationException class. 4. DOM Interfaces i) The Node Interface This interface represents single node (element, attribute, text and others) in the document tree. ii) The Document Interface This interface represents entire XML document. iii) The Element Interface This interface represents an element in an XML document. iv) The Attr Interface This interface represents an attribute in an element object. v) Additional Interface CharacterData, Comment, Text, CDataSection, Entity, Notation, ProcessingInstruction
  • 34. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 34 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 5. DOM Classes i) DocumentBuilderFactory Class This defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents. An application can use the same instance of the factory to obtain one or more instances of the DocumentBuilder. ii) DocumentBuilder Class This defines the API to obtain DOM Document instances from an XML document. Using this class, an application programmer can obtain Document from XML. 6. Node Types The following table lists what the nodeName and the nodeValue properties will return for each node type. Node Type nodeName returns nodeValue returns Document #document Null DocumentFragment #document fragment Null DocumentType #doctype name Null EntityReference Entity reference name Null Element Element name Null Attr Attribute name Attribute value ProcessingInstruction Target Content of node Comment #comment Comment text Text #text Content of node CDATASection #cdata-section Content of node Entity Entity name Null Notation Notation name Null 7. Node Operations A number of Node operations are possible  Creating nodes  Traversing nodes  Searching for nodes  Obtaining node content  Creating attributes  Removing and changing nodes  Inserting nodes 8. Example DocBuilder.java
  • 35. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 35 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET |
  • 36. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 36 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 3.13 PARSING XML USING SIMPLE API FOR XML (SAX) SAX is an interface that allows to write applications to read the data held in an XML document. It is primarily a Java interface. This is called an event-based interfaces because the parser notifies the application of the significant events as they occur. 1. SAX Packages Below is a list of all packages that consists of the classes and interfaces used for SAX parsing. org.xml.sax: This package provides the core SAX APIs. Some SAX1 APIs are deprecated to encourage integration of namespace-awareness into designs of new applications and into maintenance of existing infrastructure. org.xml.sax.helpers: This package contains "helper" classes, including support for bootstrapping SAX-based applications. org.xml.sax.ext: This package contains interfaces to SAX2 facilities that conformant SAX drivers do not necessarily support. 2. The Basic Structure
  • 37. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 37 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | i) Application The Application is the "main program", ie., the code that written to start the whole process. Job of the application  Instantiating a class that implements the org.xml.sax.XMLReader interface.  Creating a content handler (by instantiating a class that implements the org.xml.sax.ContentHandler interface).  Instructing the parser which content handler to use (by calling the XMLReader's setContentHandler() method).  Instructing the parser to start processing a particular input document (by calling the parse() method of the XMLReader). ii) XMLReader The XMLReader is an Interface for reading an XML document using callbacks. It notifies the content handler of all the interesting things it finds in the document, such as element start tags and end tags. iii) Content Handler The Content Handler is the code that written to process the contents of the document. It processes these notifications to achieve whatever the application requires. 3. Components of SAX Parser The basic outline of the SAX parsing APIs are shown on the right side of the above image. To start the process, an instance of the XMLReaderFactory class is used to generate an instance of the class.
  • 38. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 38 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | i) XMLReader  This is an interface for reading an XML document using callbacks. This should be implemented by the SAX2 driver.  This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing and to initiate a document parse.  This interface replaces the SAX 1.0 Parser interface. ii) Content Handler  This receives notification of the logical content of a document. It is the main interface that most SAX applications implement.  If the application needs to be informed of basic parsing events, it implements this interface and registers an instance with the SAX parser using the setContentHandler method.  The parser uses the instance to report basic document-related events, such as the start and end of elements and character data. iii) ErrorHandler  It provides methods such as error, fatalError, and warning which are invoked in response to various parsing errors.  The default error handler throws an exception for fatal errors and ignores other errors. iv) DTDHandler It defines methods that can be used while processing a DTD to recognize and act on declarations for an unparsed entity v) EntityResolver The resolveEntity method is invoked when the parser must identify data identified by a URI, URL or URN. In case of URN, the EntityResolver can use the public identifier instead of the URL to find document, for example to access a local copy of the document if one exists. vi) Attributes This is an interface for a list of XML attributes. This interface allows access to a list of attributes in three different ways  by attribute index  by Namespace-qualified name  by qualified (prefixed) name 4. SAX API: Classes & Interfaces i) org.xml.sax.helpers: DefaultHandler is the default base class for SAX2 event handlers. This class implements the ContentHandler, ErrorHandler, DTDHandler and EntityResolver interfaces. ii) javax.xml.parsers.SAXParser: wraps an XMLReader implementation class iii) javax.xml.parsers.SAXParseFactory: Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.
  • 39. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 39 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 5. Example: using ContentHandler public class Average extends DefaultHandler { public static void main(String argv[]) { DefaultHandler handler=new Average(); SAXParserFactory factory=SAXParserFactory.newInstance(); factory.setValidating(false); try { out=new OutputStreamWriter(System.out, "UTF8"); SAXParser saxParser=factory.newSAXParser(); saxParser.parse(new File(argv[0], handler); } catch(SAXParseException spe) { ..... } catch(SAXException sxe) { ..... } catch(IOException ioe) { ..... } } 3.14 INTEGRATING XML WITH DATABASE  XML and database integration is important because XML provides a standard technique to describe data.  By leveraging XML, a company can convert its existing corporate data into a format that is consumable by its trading partners.  XML allows the development team to define a set of custom tags specific to its industry.  A trading partner can import the XML data into its system using the given format. Example: rental_property.xml <rental_property> <prop_id>1</prop_id> <name>The Meadows</name> <address> <street>251 Eisenhower Blvd</street> <city>Houston</city> <state>TX</state> <postal_code>77033</postal_code></address> <square_footage>500.0</square_footage> <bedrooms>1.0</bedrooms> <bath>1.0</bath> <price>600</price> <contact> <phone>555-555-1212</phone> <fax>555-555-1414</fax? </contact> </rental_property>
  • 40. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 40 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 1. XML Database Solutions A large number of XML database solutions are available, and they generally come in two flavours: Database mapping and Native XML support. i) XML Database Mapping  The first type of XML database solution provides a mapping between the XML document and the database fields.  The system dynamically converts SQL result sets to XML documents.  Depending on the sophistication of the product, it may provide a graphical tool to map the database fields to the desired XML elements. XML Database Mapping Products ii) Native XML Support The second type of XML database solution actually stores the XML data in the document in its native format. Each product uses its own proprietary serialization technique to store the data.
  • 41. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 41 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Native XML Database Products 2. Modeling Databases in XML In the JAXB framework, we can parse XML documents into a suitable Java object. This technique is referred to as unmarshaling. The JAXB framework also provides the capability to generate XML documents from Java objects, which is referred to as marshaling. Figure: JAXB marshaling and unmarshaling. 3. JAXB (Java API for XML Binding) Solution The following steps are followed 1. Review the database schema. 2. Construct the desired XML document. 3. Define a schema for the XML document. 4. Create the JAXB binding schema. 5. Generate the JAXB classes based on the schema. 6. Develop a Data Access Object (DAO). 7. Develop a servlet for HTTP access. Figure: The Rental Property Application Architecture 4. Defining a Schema for the XML Document rental_property.dtd
  • 42. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 42 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 5. Creating the JAXB Binding Schema rental_property.xjs (for XML Java schema) 6. Generating the JAXB Classes Based on Schemas Figure: Generating Java classes with the JAXB compiler. The following files are generated:  RentalPropertyList.java: This file models the <rental_property_list> element.  RentalProperty.java: This file models the <rental_property> element.  Address.java: This file models the <address> subelement.  Contact.java: This file models the <contact> subelement. 7. Developing a Data Access Object (DAO) A Data Access Object (DAO) provides access to the backend database. The goal of the DAO design pattern is to provide a higher level of abstraction for database access. Figure: Data Access Object design pattern.
  • 43. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 43 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Example: public class RentalPropertyDAO { protected Connection myConn; public RentalPropertyDAO() throws DAOException { this(“sun.jdbc.odbc.JdbOdbcDriver”, ”jdbc:odbc:RentalPropertyDSN”, ”test”, “test”); } public RentalPropertyDAO(String driverName, String dbUrl, String user, String pass) throws DAOException { try { // Load the driver log(“Loading driver: “ + driverName); Class.forName(driverName); // Get a connection log(“Connecting to the database: “ + dbUrl); log(“User id: “ + user); myConn = DriverManager.getConnection (dbUrl, user, pass); log(“DB connection successful at “ + new java.util.Date()); } catch (Exception exc) { throw new DAOException(exc); } } … } 3.15 FORMATTING XML ON WEB 1. A Brief History of DSSSL 2. A Brief History of CSS 3. XML Presentation Using CSS 4. An Overview of XHTML 5. An Overview of XForms 1. A Brief History of DSSSL  In 1996, ISO approved the final draft of the Document Style Semantics and Specification Language (DSSSL) for SGML documents.  DSSSL’s specific purpose is to provide processing instructions for SGML documents.  The two main types of instructions that DSSSL provides have to do with transformations (transforming a SGML document from one structure to another) and formatting or styles (applying style sheets to SGML documents).  DSSSL defines syntax for how different elements in a SGML document will be mapped to formatting objects for display.
  • 44. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 44 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | DSSSL Style Sheet 2. A Brief History of CSS  In 1996, about the time the DSSSL standard was being finalized by the ISO, the W3C organization was finalizing its own style language.  On December 17, 1996, Cascading Style Sheets Level 1 (CSS1) became an official W3C recommendation.  CSS1 was introduced with the intention of separating, as much as possible, the formatting (visual rendering) from HTML-structured documents. Simple CSS1 Style Sheet
  • 45. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 45 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | Very Simple HTML Page 3. XML Presentation Using CSS  Interestingly enough, CSS actually works better with XML than it does with HTML.  This is because XML has none of the problems that CSS was designed to correct— namely the mingling of data structure and data formatting in HTML. notestyle.css Applying CSS to an XML Document
  • 46. Dept of CSE | III YEAR | VI SEMESTER CS T63 | WEB TECHNOLOGY | UNIT 3 46 |Prepared By : Mr. PRABU.U/AP |Dept. of Computer Science and Engineering | SKCET | 4. An Overview of XHTML Using Hyperlinks and the link Element in XHTML Basic 5. An Overview of XForms  XForms is the next generation of forms on the Web. Fully XML 1.0 compatible, XForms will provide a separation of purpose and presentation.  Also, XForms offers instance data tracking, rich data typing, and validation.  Although only a working draft now, XForms when completed will offer a great improvement over current forms technology. XForms Web Form