SlideShare a Scribd company logo
1.Explainthe architecture of .NETFramework.
2.Explainthe features of C#.
3.WAP in c# to implement inheritance
using System;
namespace InheritanceApplication
{
class Shape
{
public void setWidth(int w)
{
width = w;
}
public void setHeight(int h)
{
height = h;
}
protected int width;
protected int height;
}
// Derived class
class Rectangle: Shape
{
public int getArea()
{
return (width * height);
}
}
class RectangleTester
{
static void Main(string[] args)
{ Rectangle Rect = new Rectangle();
Rect.setWidth(5);
Rect.setHeight(7);
// Print the area of the object.
Console.WriteLine("Total area: {0}", Rect.getArea());
Console.ReadKey();
}
}
}
OUTPUT
4.WAP in c# to implement polymorphism
using System;
namespace PolymorphismApplication
{
class Printdata
{
void print(int i)
{
Console.WriteLine("Printing int: {0}", i );
}
void print(double f)
{
Console.WriteLine("Printing float: {0}" , f);
}
void print(string s)
{
Console.WriteLine("Printing string: {0}", s);
}
static void Main(string[] args)
{
Printdata p = new Printdata();
// Call print to print integer
p.print(5);
// Call print to print float
p.print(500.263);
// Call print to print string
p.print("Hello C++");
Console.ReadKey();
}
}
}
OUTPUT
5.Wap in c# to implement delegates inc#
C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type
variable that holds the reference to a method. The reference can be changed at runtime.
Delegates are especially used for implementing events and the call-back methods. All delegates
are implicitly derived from the System.Delegate class.
Declaring Delegates
Delegate declaration determines the methods that can be referenced by the delegate. A
delegate can refer to a method, which have the same signature as that of the delegate.
For example, consider a delegate:
public delegate int MyDelegate (string s);
The preceding delegate can be used to reference any method that has a single string parameter
and returns an int type variable.
Syntax for delegate declaration is:
delegate <return type> <delegate-name> <parameter list>
using System;
delegate int NumberChanger(int n);
namespace DelegateAppl
{
class TestDelegate
{
static int num = 10;
public static int AddNum(int p)
{
num += p;
return num;
}
public static int MultNum(int q)
{
num *= q;
return num;
}
public static int getNum()
{
return num;
}
static void Main(string[] args)
{
//create delegate instances
NumberChanger nc1 = new NumberChanger(AddNum);
NumberChanger nc2 = new NumberChanger(MultNum);
//calling the methods using the delegate objects
nc1(25);
Console.WriteLine("Value of Num: {0}", getNum());
nc2(5);
Console.WriteLine("Value of Num: {0}", getNum());
Console.ReadKey();
}
}
}
OUTPUT
6.WAP in c# to implement Constructors
A spec ial method of the c lass that will be automatic ally invoked when an
instanc e of the c lass is c reated is c alled as c onstruc tor.
using System;
namespace DefaultConstractor
{
class addition
{
int a, b;
public addition() //default contructor
{
a = 100;
b = 175;
}
public static void Main()
{
addition obj = new addition(); //an object is
created , constructor is called
Console.WriteLine(obj.a);
Console.WriteLine(obj.b);
Console.Read();
}
}
}
OUTPUT
7.ExplainExceptionhandling withexample using c#
An exception is a problem that arises during the execution of a program. A C# exception is a
response to an exceptional circumstance that arises while a program is running, such as an
attempt to divide by zero.
Exceptions provide a way to transfer control from one part of a program to another. C#
exception handling is built upon four keywords: try, catch, finally and throw.
 try: A try block identifies a block of code for which particular exceptions will be activated. It's
followed by one or more catch blocks.
 catch: A program catches an exception with an exception handler at the place in a program
where you want to handle the problem. The catch keyword indicates the catching of an
exception.
 finally: The finally block is used to execute a given set of statements, whether an exception is
thrown or not thrown. For example, if you open a file, it must be closed whether an exception is
raised or not.
 throw: A program throws an exception when a problem shows up. This is done using a throw
keyword.
Syntax
try
{
// statements causing exception
}
catch( ExceptionName e1 )
{
// error handling code
}
catch( ExceptionName e2 )
{
// error handling code
}
catch( ExceptionName eN )
{
// error handling code
}
finally
{
// statements to be executed
}
using System;
namespace ErrorHandlingApplication
{
class DivNumbers
{
int result;
DivNumbers()
{
result = 0;
}
public void division(int num1, int num2)
{
try
{
result = num1 / num2;
}
catch (DivideByZeroException e)
{
Console.WriteLine("Exception caught: {0}", e);
}
finally
{
Console.WriteLine("Result: {0}", result);
}
}
static void Main(string[] args)
{
DivNumbers d = new DivNumbers();
d.division(25, 0);
Console.ReadKey();
}
}
}
OUTPUT
8.WAP in c# to implement file I/O
A file is a collection of data stored in a disk with a specific name and a directory path. When a
file is opened for reading or writing, it becomes a stream.
The stream is basically the sequence of bytes passing through the communication path. There
are two main streams: the input stream and the output stream. The input stream is used for
reading data from file (read operation) and the output stream is used for writing into the file
(write operation).
C# I/O Classes
The System.IO namespace has various class that are used for performing various operation with
files, like creating and deleting files, reading from or writing to a file, closing a file etc.
The following table shows some commonly used non-abstract classes in the System.IO
namespace:
I/O Class Description
BinaryReader Reads primitive data from a binary stream.
BinaryWriter Writes primitive data in binary format.
BufferedStream A temporary storage for a stream of bytes.
Directory Helps in manipulating a directory structure.
DirectoryInfo Used for performing operations on directories.
DriveInfo Provides information for the drives.
File Helps in manipulating files.
FileInfo Used for performing operations on files.
FileStream Used to read from and write to any location in a file.
MemoryStream Used for random access to streamed data stored in memory.
Path Performs operations on path information.
StreamReader Used for reading characters from a byte stream.
StreamWriter Is used for writing characters to a stream.
StringReader Is used for reading from a string buffer.
StringWriter Is used for writing into a string buffer.
using System;
using System.IO;
namespace FileIOApplication
{
class Program
{
static void Main(string[] args)
{
FileStream F = new FileStream("test.dat",
FileMode.OpenOrCreate, FileAccess.ReadWrite);
for (int i = 1; i <= 20; i++)
{
F.WriteByte((byte)i);
}
F.Position = 0;
for (int i = 0; i <= 20; i++)
{
Console.Write(F.ReadByte() + " ");
}
F.Close();
Console.ReadKey();
}
}
}
OUTPUT
9.Write the code toadd a flashitemon your website.
<html>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/
cabs/flash/swflash.cab#version=6,0,40,0"
width="468" height="60"
id="mymoviename">
<param name="movie"
value="example.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="example.swf" quality="high" bgcolor="#ffffff"
width="468" height="60"
name="mymoviename" align="" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
</body>
</html>
10.Explain XML and DTD
A Document Type Definition (DTD) defines the legal building blocks of an XML document. It
defines the document structure with a list of legal elements and attributes.A DTD can be
declared inline inside an XML document, or as an external reference.
Internal DTD Declaration
If the DTD is declared inside the XML file, it should be wrapped in a DOCTYPE definition with the
following syntax:
<!DOCTYPE root-element [element-declarations]>
Example XML document with an internal DTD:
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>
Open the XML file above in your browser (select "view source" or "view page source" to view
the DTD)
The DTD above is interpreted like this:
!DOCTYPE note defines that the root element of this document is note
!ELEMENT note defines that the note element contains four elements: "to,from,heading,body"
!ELEMENT to defines the to element to be of type "#PCDATA"
!ELEMENT from defines the from element to be of type "#PCDATA"
!ELEMENT heading defines the heading element to be of type "#PCDATA"
!ELEMENT body defines the body element to be of type "#PCDATA"
External DTD Declaration
If the DTD is declared in an external file, it should be wrapped in a DOCTYPE definition with the
following syntax:
<!DOCTYPE root-element SYSTEM "filename">
This is the same XML document as above, but with an external DTD (Open it, and select view
source):
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
And this is the file "note.dtd" which contains the DTD:
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
XML
Extensible Markup Language, abbreviated XML, describes a class of data objects called XML
documents and partially describes the behavior of computer programs which process them.
XML is an application profile or restricted form of SGML, the Standard Generalized Markup
Language [ISO 8879]. By construction, XML documents are conforming SGML documents.XML
documents are made up of storage units called entities, which contain either parsed or
unparsed data. Parsed data is made up of characters, some of which form character data, and
some of which form markup. Markup encodes a description of the document's storage layout
and logical structure. XML provides a mechanism to impose constraints on the storage layout
and logical structure.

More Related Content

PDF
Advanced Java Practical File
PDF
3. Объекты, классы и пакеты в Java
PDF
4. Обработка ошибок, исключения, отладка
ODP
Java Concurrency
PDF
Java Programming - 06 java file io
PPTX
C++11 - STL Additions
PDF
Java_practical_handbook
PPTX
Advanced Java Practical File
3. Объекты, классы и пакеты в Java
4. Обработка ошибок, исключения, отладка
Java Concurrency
Java Programming - 06 java file io
C++11 - STL Additions
Java_practical_handbook

What's hot (20)

PDF
Important java programs(collection+file)
PPTX
Java nio ( new io )
PDF
Java programs
DOCX
Java practical
PPT
NIO.2, the I/O API for the future
PPTX
C++11 Multithreading - Futures
DOCX
Java PRACTICAL file
PPTX
Unit Testing with Foq
PPT
Thread
PDF
C++aptitude questions and answers
PDF
PDF
JAVA NIO
DOC
Final JAVA Practical of BCA SEM-5.
PDF
Spock: A Highly Logical Way To Test
PPT
JDK1.7 features
PDF
Grails/Groovyによる開発事例紹介
PPTX
iOS Session-2
PPT
C# Application program UNIT III
PDF
DCN Practical
PDF
Core java pract_sem iii
Important java programs(collection+file)
Java nio ( new io )
Java programs
Java practical
NIO.2, the I/O API for the future
C++11 Multithreading - Futures
Java PRACTICAL file
Unit Testing with Foq
Thread
C++aptitude questions and answers
JAVA NIO
Final JAVA Practical of BCA SEM-5.
Spock: A Highly Logical Way To Test
JDK1.7 features
Grails/Groovyによる開発事例紹介
iOS Session-2
C# Application program UNIT III
DCN Practical
Core java pract_sem iii
Ad

Viewers also liked (18)

PPT
工作人生
PDF
Jamison Door Company Catalog
PPTX
Quotes from Leaders in the Civic Engagement Movement
PPTX
Classification of Fonts and Calligraphy Styles based on Complex Wavelet Trans...
ODP
Eiiiiiiiiiiii
PDF
BÍ QUYẾT QUẢN LÝ HIỆU QUẢ CÂU LẠC BỘ CHA MẸ VÀ VỊ THÀNH NIÊN, THANH NIÊN
PPTX
Mini-Training: Let's have a rest
PDF
Rising Asia - Inaugural Issue, April 2015
PPTX
Financial aid assistance
PDF
Clinic practice of nebulized therapy in China(a national questionnaire survey)
ODT
Nce2文本
PDF
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
PPT
A Career in Teaching - Isobel Kerr [Scottish Teacher Recruitment Team]
PDF
Chongqing municipal people's government work report
PDF
5 kinesis lightning
PPTX
Caring for Sharring
PPT
How tall are you ——小虫
PPT
Pass Love Charity Foundation (PLCF)
工作人生
Jamison Door Company Catalog
Quotes from Leaders in the Civic Engagement Movement
Classification of Fonts and Calligraphy Styles based on Complex Wavelet Trans...
Eiiiiiiiiiiii
BÍ QUYẾT QUẢN LÝ HIỆU QUẢ CÂU LẠC BỘ CHA MẸ VÀ VỊ THÀNH NIÊN, THANH NIÊN
Mini-Training: Let's have a rest
Rising Asia - Inaugural Issue, April 2015
Financial aid assistance
Clinic practice of nebulized therapy in China(a national questionnaire survey)
Nce2文本
What's a Good Chinese Daily Deal - A Market Analysis - May 2011 - Dataotuan.com
A Career in Teaching - Isobel Kerr [Scottish Teacher Recruitment Team]
Chongqing municipal people's government work report
5 kinesis lightning
Caring for Sharring
How tall are you ——小虫
Pass Love Charity Foundation (PLCF)
Ad

Similar to srgoc (20)

DOCX
Srgoc dotnet
ODT
Java practical
DOCX
Parallel Programming With Dot Net
PPTX
ExtraFileIO.pptx
PPT
Attributes & .NET components
PPTX
Lec05 buffers basic_examples
PDF
Book
PDF
Borland star team to tfs simple migration
PPT
M251_Meeting 7 (Exception Handling and Text IO).ppt
PPTX
15. text files
DOCX
System programmin practical file
DOCX
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
DOCX
C# Unit 2 notes
PDF
Workshop 23: ReactJS, React & Redux testing
DOC
Lex tool manual
DOCX
Program Assignment Process ManagementObjective This program a.docx
PDF
Object Oriented Solved Practice Programs C++ Exams
PDF
Java programming lab manual
PPT
data Structure Lecture 1
PPTX
Presentation.pptx
Srgoc dotnet
Java practical
Parallel Programming With Dot Net
ExtraFileIO.pptx
Attributes & .NET components
Lec05 buffers basic_examples
Book
Borland star team to tfs simple migration
M251_Meeting 7 (Exception Handling and Text IO).ppt
15. text files
System programmin practical file
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
C# Unit 2 notes
Workshop 23: ReactJS, React & Redux testing
Lex tool manual
Program Assignment Process ManagementObjective This program a.docx
Object Oriented Solved Practice Programs C++ Exams
Java programming lab manual
data Structure Lecture 1
Presentation.pptx

More from Gaurav Singh (7)

PPTX
Oral presentation
PPTX
srgoc dotnet_ppt
DOCX
Srgoc dotnet_new
DOCX
ADA FILE
DOCX
Srgoc linux
DOCX
Srgoc java
DOCX
cs506_linux
Oral presentation
srgoc dotnet_ppt
Srgoc dotnet_new
ADA FILE
Srgoc linux
Srgoc java
cs506_linux

Recently uploaded (20)

PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
737-MAX_SRG.pdf student reference guides
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
additive manufacturing of ss316l using mig welding
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
DOCX
573137875-Attendance-Management-System-original
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
introduction to datamining and warehousing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
737-MAX_SRG.pdf student reference guides
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Embodied AI: Ushering in the Next Era of Intelligent Systems
additive manufacturing of ss316l using mig welding
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Mechanical Engineering MATERIALS Selection
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
573137875-Attendance-Management-System-original
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
introduction to datamining and warehousing
CYBER-CRIMES AND SECURITY A guide to understanding
Foundation to blockchain - A guide to Blockchain Tech
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Categorization of Factors Affecting Classification Algorithms Selection
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx

srgoc

  • 1. 1.Explainthe architecture of .NETFramework. 2.Explainthe features of C#. 3.WAP in c# to implement inheritance using System; namespace InheritanceApplication { class Shape { public void setWidth(int w) { width = w; } public void setHeight(int h) { height = h; } protected int width; protected int height; } // Derived class class Rectangle: Shape { public int getArea() { return (width * height); } } class RectangleTester { static void Main(string[] args) { Rectangle Rect = new Rectangle(); Rect.setWidth(5); Rect.setHeight(7); // Print the area of the object. Console.WriteLine("Total area: {0}", Rect.getArea()); Console.ReadKey(); }
  • 3. 4.WAP in c# to implement polymorphism using System; namespace PolymorphismApplication { class Printdata { void print(int i) { Console.WriteLine("Printing int: {0}", i ); } void print(double f) { Console.WriteLine("Printing float: {0}" , f); } void print(string s) { Console.WriteLine("Printing string: {0}", s); } static void Main(string[] args) { Printdata p = new Printdata(); // Call print to print integer p.print(5); // Call print to print float p.print(500.263); // Call print to print string p.print("Hello C++"); Console.ReadKey(); } } }
  • 5. 5.Wap in c# to implement delegates inc# C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime. Delegates are especially used for implementing events and the call-back methods. All delegates are implicitly derived from the System.Delegate class. Declaring Delegates Delegate declaration determines the methods that can be referenced by the delegate. A delegate can refer to a method, which have the same signature as that of the delegate. For example, consider a delegate: public delegate int MyDelegate (string s); The preceding delegate can be used to reference any method that has a single string parameter and returns an int type variable. Syntax for delegate declaration is: delegate <return type> <delegate-name> <parameter list>
  • 6. using System; delegate int NumberChanger(int n); namespace DelegateAppl { class TestDelegate { static int num = 10; public static int AddNum(int p) { num += p; return num; } public static int MultNum(int q) { num *= q; return num; } public static int getNum() { return num; } static void Main(string[] args) { //create delegate instances NumberChanger nc1 = new NumberChanger(AddNum); NumberChanger nc2 = new NumberChanger(MultNum); //calling the methods using the delegate objects nc1(25); Console.WriteLine("Value of Num: {0}", getNum()); nc2(5); Console.WriteLine("Value of Num: {0}", getNum()); Console.ReadKey(); }
  • 8. 6.WAP in c# to implement Constructors A spec ial method of the c lass that will be automatic ally invoked when an instanc e of the c lass is c reated is c alled as c onstruc tor. using System; namespace DefaultConstractor { class addition { int a, b; public addition() //default contructor { a = 100; b = 175; } public static void Main() { addition obj = new addition(); //an object is created , constructor is called Console.WriteLine(obj.a); Console.WriteLine(obj.b); Console.Read(); } } } OUTPUT
  • 9. 7.ExplainExceptionhandling withexample using c# An exception is a problem that arises during the execution of a program. A C# exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero. Exceptions provide a way to transfer control from one part of a program to another. C# exception handling is built upon four keywords: try, catch, finally and throw.  try: A try block identifies a block of code for which particular exceptions will be activated. It's followed by one or more catch blocks.  catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.  finally: The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.  throw: A program throws an exception when a problem shows up. This is done using a throw keyword. Syntax try { // statements causing exception } catch( ExceptionName e1 ) {
  • 10. // error handling code } catch( ExceptionName e2 ) { // error handling code } catch( ExceptionName eN ) { // error handling code } finally { // statements to be executed } using System; namespace ErrorHandlingApplication { class DivNumbers { int result; DivNumbers() { result = 0; } public void division(int num1, int num2) { try { result = num1 / num2; } catch (DivideByZeroException e) { Console.WriteLine("Exception caught: {0}", e); } finally { Console.WriteLine("Result: {0}", result); }
  • 11. } static void Main(string[] args) { DivNumbers d = new DivNumbers(); d.division(25, 0); Console.ReadKey(); } } } OUTPUT
  • 12. 8.WAP in c# to implement file I/O A file is a collection of data stored in a disk with a specific name and a directory path. When a file is opened for reading or writing, it becomes a stream. The stream is basically the sequence of bytes passing through the communication path. There are two main streams: the input stream and the output stream. The input stream is used for reading data from file (read operation) and the output stream is used for writing into the file (write operation). C# I/O Classes The System.IO namespace has various class that are used for performing various operation with files, like creating and deleting files, reading from or writing to a file, closing a file etc. The following table shows some commonly used non-abstract classes in the System.IO namespace: I/O Class Description BinaryReader Reads primitive data from a binary stream. BinaryWriter Writes primitive data in binary format. BufferedStream A temporary storage for a stream of bytes.
  • 13. Directory Helps in manipulating a directory structure. DirectoryInfo Used for performing operations on directories. DriveInfo Provides information for the drives. File Helps in manipulating files. FileInfo Used for performing operations on files. FileStream Used to read from and write to any location in a file. MemoryStream Used for random access to streamed data stored in memory. Path Performs operations on path information. StreamReader Used for reading characters from a byte stream. StreamWriter Is used for writing characters to a stream. StringReader Is used for reading from a string buffer. StringWriter Is used for writing into a string buffer. using System; using System.IO; namespace FileIOApplication { class Program { static void Main(string[] args) { FileStream F = new FileStream("test.dat", FileMode.OpenOrCreate, FileAccess.ReadWrite); for (int i = 1; i <= 20; i++)
  • 14. { F.WriteByte((byte)i); } F.Position = 0; for (int i = 0; i <= 20; i++) { Console.Write(F.ReadByte() + " "); } F.Close(); Console.ReadKey(); } } } OUTPUT 9.Write the code toadd a flashitemon your website. <html> <body> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60" id="mymoviename">
  • 15. <param name="movie" value="example.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed src="example.swf" quality="high" bgcolor="#ffffff" width="468" height="60" name="mymoviename" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed> </object> </body> </html> 10.Explain XML and DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list of legal elements and attributes.A DTD can be declared inline inside an XML document, or as an external reference. Internal DTD Declaration If the DTD is declared inside the XML file, it should be wrapped in a DOCTYPE definition with the following syntax: <!DOCTYPE root-element [element-declarations]> Example XML document with an internal DTD: <?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <note> <to>Tove</to>
  • 16. <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body> </note> Open the XML file above in your browser (select "view source" or "view page source" to view the DTD) The DTD above is interpreted like this: !DOCTYPE note defines that the root element of this document is note !ELEMENT note defines that the note element contains four elements: "to,from,heading,body" !ELEMENT to defines the to element to be of type "#PCDATA" !ELEMENT from defines the from element to be of type "#PCDATA" !ELEMENT heading defines the heading element to be of type "#PCDATA" !ELEMENT body defines the body element to be of type "#PCDATA" External DTD Declaration If the DTD is declared in an external file, it should be wrapped in a DOCTYPE definition with the following syntax: <!DOCTYPE root-element SYSTEM "filename"> This is the same XML document as above, but with an external DTD (Open it, and select view source): <?xml version="1.0"?> <!DOCTYPE note SYSTEM "note.dtd"> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> And this is the file "note.dtd" which contains the DTD:
  • 17. <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> XML Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents and partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of SGML, the Standard Generalized Markup Language [ISO 8879]. By construction, XML documents are conforming SGML documents.XML documents are made up of storage units called entities, which contain either parsed or unparsed data. Parsed data is made up of characters, some of which form character data, and some of which form markup. Markup encodes a description of the document's storage layout and logical structure. XML provides a mechanism to impose constraints on the storage layout and logical structure.