XML

JavaXml Projects

JavaXml Project

JavaXml Examples

JavaXml EXAMPLE

XML

R4R provide basic XML Tutorials concept with XML Examples .Through R4R you can develop XML programming concept. R4R provide XML Interview Questions with answers.R4R provide XML Languages study materials in easy way.

Introduction Of XML

XML (eXtensible Markup Language) is a specification developed by the World Wide Web Consortium (W3C).it is very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere. It is a markup language much like HTML used to describe data.

In XML, tags are not predefined. A user defines his own tags and XML document structure like Document Type Definition (DTD) , XML Schema to describe the data. Hence it is self-descriptive too .There is Nothing Special About XML It is just plain text with the addition of some XML tags enclosed in angle brackets. In a simple text editor, the XML document is easily visible .

  • Document Type Definition 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.
  • XML Schema XML Schema is an XML-based alternative to DTDs. It describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD).
  • Well FormedXML document is a document that conforms to the XML syntax rules.
  • Valid XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD)
  • History Of XML

    XML was developed to overcome the shortcomings of its two predecessors, HTML and SGML which were both very successful markup languages, but which were both restricted in certain ways.

    SGML

    SGML, the international standard for marking up data, has been used since the 1980's. SGML is an extremely powerful and extensible tool for semantic markup which is particularly useful for cataloging and indexing data. Like XML, SGML can be used to create an infinite number of markup languages and has a host of other resources as well.

    However, SGML is complex, especially for the everyday uses of the web. Moreover, SGML is expensive. Adding SGML capability to a word processor could double or triple the price. Finally, the commercial browsers do not intend to ever support SGML.

    HTML

    HTML on the other hand was free, simple and widely supported. HTML was originally designed to provide a very simple version of SGML which could be used by regular people. However, HTML had serious defects.

    XML So in 1996, discussions began which focused on how to define a markup language with the power and extensibility of SGML but with the simplicity of HTML. The World Wide Web Consortium (W3C) decided to sponsor a group of SGML gurus including Jon Bosak from Sun. Essentially, Bosak and his team did to SGML what the Java team had done to C++. All of the non-essential, unused, cryptic parts of SGML were sliced away.

    What remained was a lean, mean marking up machine: XML. The specification of XML (written mostly by Tim Bray and C.M. Sperberg-McQueen) was only 26 pages as opposed to the 500+ pages of the SGML specification! Nevertheless, all the useful things which could be done by SGML, could also be done with XML.

    XML

    Over the next few years, XML evolved, drawing from the work of its sponsors and the work of developers solving similar problems such as Peter Murray-Rust who had been working on CML (Chemical Mark-up Language) and the consortium of folks working on MathML. By mid 1997 The eXtensible Linking Language XML project was underway and by the summer of 1997, Microsoft had launched the Channel Definition Format (CDF) as one of the first real-world applications of XML.

    Finally, in 1998, the W3C approved Version 1.0 of the XML specification and a new language was born.
    Why Is XML So Important

    There are number of reasons that contributes to the XML's increasing acceptance , few of them are

    1. Plain Text
    2. Data Identification
    3. Satiability
    4. Universally Processed
    5. Hierarchical Approach
    6. Inline Reusability
    Architecture Of XML

    A basic architecture of an XML application using DOM is presented: In This Figure A parser reads the XML file and builds a DOM document to match the XML file. From that point until a save is performed, all interaction between the application and XML hits the DOM document rather than the corresponding XML file. It interesting to note that almost all XML parsers use SAX

    Before you build a DOM document you must detect events such as the start of an element (start tag encountered), end of an element (end tag encountered) and/or a new attribute (name followed by equal sign followed by quoted string encountered). DOM can be thought of as an extra abstraction to lessen the programmer workload, at the expense of memory usage

    Modifications are made directly to the DOM document. Elements can be added, deleted, renamed, and rearranged. Text nodes can be added, deleted or changed. Elements can be moved either within the same level, or promoted or demoted to different levels

    Advantage of XML
    1. It is text-based.
    2. It is platform-independent.
    3. It manifests as plain text files.
    4. Integrating with Existing Data Types
    5. Extensibility
    6. It supports Unicode (allowing information in any language).
    7. It can represent data structures: records, lists and trees.
    8. It is based on international standards.
    9. The hierarchical structure is suitable for most types of documents.
    10. It makes parsing algorithms simple, efficient, and consistent.
    Difference Between Html and XML
    XML HTML
    XML was designed to describe data and to focus on what data is HTML was designed to display data and to focus on how data looks .
    XML is about describing information HTML is about displaying information,
    XML is not either a programming language or a presentation language. It is used to transfer data between applications and databases HTML is presentation language
    XML is case-sensitive HTML is not case-sensitive
    In XML it is mandatory to close each and every tag HTML it is not required
    In XML, Data is stored in separate XML files HTML, it is stored inside the files.White Spaces is preserved in XML files.
    To display XML, we used XSL To display HTML, we used CSS
    Relation Between SGML And XML

    XML is a real subset of SGML. The most important difference is that output specification is not defined by SGML, but it is fixed in XML.

    Importance Feature Of XML
    1. XML files are text files, which can be managed by any text editor.
    2. XML is very simple, because it has less than 10 syntax rules.
    3. XML is extensible, because it only specifies the structural rules of tags. No specification on tags them self.
    Disadvantage
    1. Syntax is redundant or large relative to binary representations of similar data
    2. The hierarchy schemata can be limiting
    3. Syntax is verbose relative to other alternative 'text-based' formats.
    4. More difficult, demanding, and precise than HTML
    5. It does not support data types, such as 'integer', 'string', 'boolean', and so on.
    6. Lack of browser support/end user applications
    7. The hierarchical model for representation is limited in comparison to an object oriented model.
    8. Namespaces are problematic to use and support
    XLXP Tutorials
    XML Examples
    XML Interview Materials