Вы находитесь на странице: 1из 7

XML AND ITS APPLICATIONS

1. About XML Database


XML Database is used to store huge amount of information in the XML format. As the use of
XML is increasing in every field, it is required to have a secured place to store the XML
documents. The data stored in the database can be queried using XQuery, serialized, and exported
into the desired format.

XML Database Types


There are two major types of XML databases −
● XML- enabled
● Native XML (NXD)

-> XML - Enabled Database


XML enabled database is nothing but the extension provided for the conversion of an XML
document. This is a relational database, where data is stored in tables consisting of rows and
columns. The tables contain a set of records, which in turn consist of fields. XML enabled
databases typically offer one or more of the following approaches to storing XML within the
traditional relational structure:
1. XML is stored into a CLOB (Character large object)
2. XML is `shredded` into a series of Tables based on a Schema
3. XML is stored into a native XML Type as defined by ISO Standard 9075-14
RDBMS that supports the ISO XML Type is:
1. IBM DB2 (pureXML)
2. Microsoft SQL Server
3. Oracle Database
4. PostgreSQL

-> Native XML Database


THE native XML database is based on the container rather than the table format. It can store a
large number of XML documents and data. Native XML database is queried by the XPath-
expressions. Native XML database has an advantage over the XML-enabled database. It is highly
capable to store, query and maintain the XML document than XML-enabled database. Native
XML databases are specially tailored for working with XML data. As managing XML as large
strings would be inefficient, and due to the hierarchical nature of XML, custom optimized data
structures are used for storage and querying. This usually increases performance both in terms of
read-only queries and updates. XML nodes and documents are the fundamental units of (logical)
storage, just as a relational database has fields and rows.
The standard for querying XML data per W3C recommendation is XQuery; the latest version is
XQuery 3.1. XQuery includes XPath as a sub-language and XML itself is a valid sub-syntax of
XQuery. In contrast to XML enabled databases, native databases provide full support for XQuery.
In addition to XPath, some XML databases support XSLT as a method of transforming documents
or query results retrieved from the database.

2. Definition
Extensible Markup Language (XML) is used to describe data. The XML standard is a flexible way
to create information formats and electronically share structured data via the public Internet, as
well as via corporate networks.

XML code, a formal recommendation from the World Wide Web Consortium (W3C), is similar
to Hypertext Markup Language (HTML). Both XML and HTML contain markup symbols to
describe the page or file contents. HTML code describes Web page content (mainly text and
graphic images) only in terms of how it is to be displayed and interacted with.

XML data is known as self-describing or self-defining, meaning that the structure of the data is
embedded with the data, thus when the data arrives there is no need to pre-build the structure to
store the data; it is dynamically understood within the XML. The XML format can be used by any
individual or group of individuals or companies that want to share information in a consistent way.
XML is actually a simpler and easier-to-use subset of the Standard Generalized Markup Language
(SGML), which is the standard to create a document structure.

The basic building block of an XML document is an element, defined by tags. An element has a
beginning and an ending tag. All elements in an XML document are contained in an outermost
element known as the root element. XML can also support nested elements or elements within
elements. This ability allows XML to support hierarchical structures. Element names describe the
content of the element, and the structure describes the relationship between the elements.

An XML document is considered to be "well-formed" (that is, able to be read and understood by
an XML parser) if its format complies with the XML specification, if it is properly marked up, and
if elements are properly nested. XML also supports the ability to define attributes for elements and
describe characteristics of the elements in the beginning tag of an element.
3. Example
Following example demonstrates XML database −
<?xml version = "1.0"?>
<contact-info>
<contact1>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</contact1>

<contact2>
<name>Manisha Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 789-4567</phone>
</contact2>
</contact-info>
4. Why XML is used?
Applications for XML are endless. For example, computer makers might agree upon a standard or
common way to describe the information about a computer product (processor speed, memory
size, and so forth) and then describe the product information format with XML code. Such a
standard way of describing data would enable a user to send an intelligent agent (a program) to
each computer maker's Web site, gather data, and then make a valid comparison. Web developers
use the XML files for following purposes:

1. Storing the data for some applications such as menu data or data for some combo boxes.
2. For developing the database-driven websites.
3. In the image, gallery application is can work as the data file (XML) for storing the names
and location of the images
4. For shopping application, it can be used to store the product details
5. In travel applications, XML data can be used to talk to the booking gateway.
6. On the web services such as Weather services, Currency rates service, etc. are using the
XML language
7. Web developers can use the XML data files to generate the dynamic content by applying
different Style sheets.
8. XML is also used to develop the content management systems
9. Many companies are using XML files to write the documents. Then programs like
DocBook can be used to generate the required documents.
10. Database development with the XML is another good use of XML. Your program can use
the XML data file for business processing.
11. Many software development frameworks are using XML files to store the configuration
data for the application. For example, JPA uses a persistence.xml file for configuring the
JPA environment.
12. Many companies are using XML for electronic data exchanges
13. XML is used to transport and the data on the internet and between different programs
14. XML is also used very easily where using database and flat files are difficult.
15. XML is also used to create other languages MathXml, SVG, etc.
16. In XML there is a total separation of XML data and style sheet.
17. Many databases are providing the support for XML database

5. Why XML is so important in programming?


These days programming of almost all the technologies is using an XML file to store the data or
transport the data over the internet. With the help of XML, you can send the data from your Java
program to a .NET application and vice versa. XML is supported by PHP, Java, ASP, .NET, C,
C++, Perl, Python, and almost all the programming languages. XML parser API is used by the
programmers to parse the data stored in an XML file. XML parsers are available for all the
programming languages, which makes the use of the XML file very easy.

6. More XML technologies:


XQuery: XQuery is a query language for XML.
XSL(T): XML Stylesheets is used to generate the Html output from the XML data
XForms: XML Forms
XLink: XML defined Link
DTD: Is used to define the document type for the XML

7. XML Applications
The following are some of the many applications for which XML is useful:

● Web publishing: XML allows you to create interactive pages, allows the customer to
customize those pages, and makes creating e-commerce applications more intuitive. With
XML, you store the data once and then render that content for different viewers or devices
based on style sheet processing using an Extensible Style Language (XSL)/XSL
Transformation (XSLT) processor.
● Web searching and automating Web tasks: XML defines the type of information
contained in a document, making it easier to return useful results when searching the Web:
For example, using HTML to search for books authored by Tom Brown is likely to return
instances of the term 'brown' outside of the context of the author. Using XML restricts the
search to the correct context (for example, the information contained in the <author> tag)
and returns only the information that you want. By using XML, Web agents and robots
(programs that automate Web searches or other tasks) are more efficient and produce more
useful results.
● General applications: XML provides a standard method to access information, making it
easier for applications and devices of all kinds to use, store, transmit, and display data.
● e-business applications: XML implementations make electronic data interchange (EDI)
more accessible for information interchange, business-to-business transactions, and
business-to-consumer transactions.
● Metadata applications: XML makes it easier to express metadata in a portable, reusable
format.
● Pervasive computing: XML provides portable and structured information types for
display on pervasive (wireless) computing devices such as personal digital assistants
(PDAs), cellular phones, and others. For example, WML (Wireless Markup Language) and
VoiceXML are currently evolving standards for describing visual and speech-driven
wireless device interfaces.

8. XML Related Technologies

The XML specification only stipulates the syntax for XML. Accordingly, the following XML
related technologies play an important role in actually using XML:
->DOM
The DOM specification is recommended by the W3C (World Wide Web Consortium), the
standards organization for Internet-related technologies.
Under DOM, XML documents and HTML documents are modeled on a tree structure (DOM
Tree) when being processed. External applications use this DOM Tree and included nodes
(element nodes and attribute nodes, etc.) to perform operations on XML and HTML documents.
The DOM specification defines the different "levels" of DOM: the higher the level, the more
advanced features it supports. Under the DOM specification, the entire XML document is first
loaded into memory, allowing for the easy creation of new nodes, or node movement/ deletion.
Saving the last DOM Tree in memory allows for the creation or update of an XML document.
The drawbacks of DOM include the fact that an entire XML document must be analyzed when
first constructing the DOM Tree and the fact that the entire XML document must be loaded into
memory. The large the XML document, the greater the overhead in terms of processing and
memory used.
-> SAX
SAX is a specification created through the XML-DEV mailing list, rather than being a W3C-
recommended specification. Processing via SAX is light and quick in contrast to DOM. SAX
loads an XML document in order from top to bottom and is an event-driven API that notifies the
application of an event regarding information associated with the detection of an element's start
tag or end tag, or occurrences of text. On the application side, the event received is processed to
acquire the data from within the XML document.
The benefit of SAX is that processing can be conducted while analyzing the XML document-
there is no need to load the entire document first as with DOM. On the other hand, not having an
API for XML document updating means that any XML document updates have to be handled
from within the application. Also, SAX only loads an XML document in order from top to
bottom, so forward or backward referencing of XML documents must be performed by the
application. SAX is especially suited for searching for and extracting data from XML documents.

Вам также может понравиться