Unit - I
Unit - I
SGML
HTML
DHTML
XHTML
JAVA SCRIPT
VB SCRIPT
ASP
JSP
AND SO ????? NEXT ????
HTML was defined using SGML
Standard Generalized Mark-up Language
A meta-language for defining languages
Complex, sophisticated, powerful
Problems with SGML
Too complicated a language
Rules are too strict
Not good in a distributed environment
Can’t mix different data together
Hyper Text Markup Language
A simple language for displaying text
Started with very few tags …
Language evolved, as more tags were added
Forms,tables,fonts,frames
XML - Introduction
HTML SMIL SpeechML XUL
XHTML MathML RDF
TEI ...
...
XML
SGML
XML stands for Extensible Markup Language
XML is a markup language much like HTML
XML was designed to describe data[carry
data], not to display data
XML is a Well Formed document
XML tags are not predefined. You must
define your own tags
XML is designed to be self-descriptive
XML is a W3C Recommendation
BENEFITS
Simplicity Facilitates the comparison and
aggregation of data
Openness
Extensibility Can embed multiple data types
Self-description
Can embed existing data
Contains machine-readable
context information
Provides a 'one-server view' for
distributed data
Supports multilingual
documents and Unicode
Rapid adoption by industry
Separates the process and its
data contents-loosely coupled
XML stands for eXtensible Markup Language
HTML is used to mark up XML is used to mark up
text so it can be displayed to data so it can be processed
users by computers
HTML describes both XML describes only
structure (e.g. <p>, <h2>, content, or “meaning”
<em>) and appearance (e.g.
<br>, <font>, <i>)
XSD
defines elements that can appear in a document
defines attributes that can appear in a document
defines which elements are child elements
defines the order of child elements
defines the number of child elements
defines whether an element is empty or can include text
defines data types for elements and attributes
defines default and fixed values for elements and attributes
XSL
XSL describes how the XML document should be displayed!
XSL consists of three parts:
▪ XSLT - a language for transforming XML documents
▪ XPath - a language for navigating in XML documents
▪ XSL-FO - a language for formatting XML documents
XSLT
A common way to describe the transformation process is to say that XSLT
transforms an XML source-tree into an XML result-tree.
XSLT stands for XSL Transformations
XSLT is the most important part of XSL
XSLT transforms an XML document into another XML document
XSLT uses XPath to navigate in XML documents
XSLT is a W3C Recommendation
Structuring With Schemas
XML document includes the following
EXAMPLE
<xs:element name="employee" type="fullpersoninfo"/>
<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="fullpersoninfo">
<xs:complexContent>
<xs:extension base="personinfo">
<xs:sequence>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
XML PROCESSING
DOM
SAX
The JavaTM API for XML Processing (JAXP) includes the
basic facilities for working with XML documents through the
following standardized set of Java Platform APIs. There are
two types of XML Parsers namely
Document Object Model (DOM)
Simple API For XML Parsing (SAX)
The XML DOM (Document Object Model) defines a standard
way for accessing and manipulating XML documents.
Your program
startDocument(...)
The SAX parser
startElement(...)
main(...)
parse(...) characters(...)
endElement( )
endDocument( )
THE SAMPLE CLASS, I
// For simplicity, we let the operating system handle exceptions
// In "real life" this is poor programming practice
public class Sample {
public static void main(String args[]) throws Exception {
// Create a parser factory
SAXParserFactory factory = SAXParserFactory.newInstance();
// Tell factory that the parser must understand namespaces
factory.setNamespaceAware(true);
// Make the parser
SAXParser saxParser = factory.newSAXParser();
XMLReader parser = saxParser.getXMLReader();