Scripting Language-2 XML
Scripting Language-2 XML
Ans:
Extensible Markup Language (XML) is a markup language that defines a
set of rules for encoding documents in a format that is both human-
readable and machine-readable.
The design goals of XML focus on simplicity, generality, and usability
across the Internet. It is a textual data format with strong support via
Unicode for different human languages.
Although the design of XML focuses on documents, the language is
widely used for the representation of arbitrary data structures such as
those used in web services.
o XML stands for extensible Markup Language
o XML is a markup language like HTML
o XML is designed to store and transport data
o XML is designed to be self-descriptive
Features of xml:
Application of xml:
I. Data transfer
II. Formatting documents
III. Web searching
IV. Creating layouts
V. Storing configuration data
1.Processing Instructions:
An XML Documents usually begins with the XML declaration statement called
the Processing Instructions .This statement provides information on how the
XML file should be processed.
e.g. <?xml version =”1.0” encoding=”UTF-8”?>
The Processing Instruction statement uses the encoding property to specify the
encoding scheme used to create the XML file
2. Tags:
Tags are used to specify a name for a given piece of information. It is a means
of identifying data. Data is marked up using tags.
3. Elements:
Elements are the basic units used to identify and describe the data in XML.
They are the building blocks of an XML document. Elements are represented
using tags.
4. Content:
Content refers to the information represented by the elements of an XML
document. Consider the following example:
<name>Jayanta</name >
5. Attributes:
Attributes provide additional information about the elements for which they are
declared. An attribute consists of a name-value pair. Consider the following
example:
<Student_name S_ID = “101”> Jayanta </ Student_name >
6. Entities:
An entity is a name that is associated with a block of data, such as chunk of text
or a reference to an external file that contains textual or binary information. It is
a set of information that can be specifying a single name.
7. Comments:
Comments are statements used to explain the XML code. They are used to
provide documentation information about the XML file or the application to
which the file belongs. The parser ignores comments entries during code
execution.
3) Write difference between XML & XSLT?
Ans:
XML XSLT
XML is used for storing data in XSLT is used for transforming
a structured format. and also for formatting XML
file to display the content or to
process the content.
XML does not perform XSLT is a specialized language
transformation of data. that performs transformation
of one XML document into a
different XML document. XSLT
can also perform
transformation of XML
document into HTML
document and XHTML
document.
XPath is a specialized language XSLT will be using XPath for
that is used to address transformation and formatting
portions of the XML file of XML file.
XML stands for extensible XSLT stands for Extensible
markup language stylesheet language
transformation.
Ans:
XML Schema:
XML schema is a language which is used for expressing constraint
about XML documents. There are so many schema languages which
are used now a days for example Relax- NG and XSD (XML schema
definition).
An XML schema is used to define the structure of an XML document.
It is like DTD but provides more control on XML structure.
XML Schema is commonly known as XML Schema Definition (XSD).
It is used to describe and validate the structure and the content of
XML data. XML schema defines the elements, attributes and data
types.
Schema element supports Namespaces. It is similar to a database
schema that describes the data in a database.
1. simple Type
2. complex Type
Simple Type:
The simple Type allows you to have text-based elements. It contains less
attributes, child elements, and cannot be left empty.
Complex Type:
The complex Type allows you to hold multiple attributes and elements. It
can contain additional sub elements and can be left empty.
DTD XSD
DTD stands for Document Type XSD stands for XML Schema
Definition. Definition
DTDs are derived from SGML syntax XSDs are written in XML.
DTD doesn't support datatypes. XSD supports datatypes for elements
and attributes.
DTD doesn't support namespace. XSD supports namespace.
DTD doesn't define order for child XSD defines order for child elements.
elements.
DTD is not extensible. XSD is extensible.
DTD is not simple to learn. XSD is simple to learn because you
don't need to learn new language.
DTD provides less control on XML XSD provides more control on XML
structure. structure.