Java and XML joint programming

Source: Internet
Author: User
Tags definition xslt
Xml| programming from the date of the birth of XML, it has been the industry's focus on one of the topics. After several years of development, XML technology is becoming more and more mature, now more and more applications are based on XML development. Today, with the increasing popularity of the Internet, distributed programming is becoming more and more important, and more and more applications are beginning to change in this direction. In this field, XML, as a kind of intermediate data interface, has shown its irreplaceable importance. At the same time, the potential of the Java language to develop internet-distributed applications is also being favored by more and more people, and the EJB architecture is becoming increasingly sophisticated. With Java, people can quickly develop portable, resilient, easy to manage distributed applications.

The Java language has always been considered one of the most suitable languages for XML programming. Platform-Independent language Java plus platform-independent data XML can indeed accomplish the most complex and resilient distributed applications.
The introduction of XML in Java applications is not very difficult, and there are already many specifications and many classes of libraries developed to simplify the programming of XML in Java. Among these specifications, sax and Dom are the most popular, and the latter is the standard recommended by the consortium. The Java class Library, which supports XML, is numerous, along with similar offerings from giants like IBM and Microsoft, in addition to the JXAP published by Sun. Also, most of these products are free and don't cost a penny. All of these specifications and class libraries have largely simplified the complexity of XML programming, and you can already do XML programming by understanding the APIs defined by these specifications and JXAP. And the purpose of our article is to introduce these specifications and APIs. Believe that after reading this article, you will no longer think of XML programming is how difficult.

Background knowledge
There's been a lot of discussion about XML, and it's a matter of opinion about XML. The next exact definition of XML is a difficult thing to do, but we can look at the following four aspects:

1.XML is a markup language that is designed to be easily propagated over the Internet. XML is compatible with SGML (specifically a simplified subset of SGML) and can be easily browsed and edited in any text editor.

2.XML defines the logical structure of the data and organizes all the data in a tree, making it easy to understand and process XML documents. The structure of an XML document is predefined through a DTD or schema, which makes the data in XML have a definite meaning in a particular application.

3.XML is a strictly defined language that has little definition of optional features. This allows XML to achieve maximum versatility, and any XML-compliant parser can parse a legitimate XML document without any errors. In this way, XML can be used as an intermediary in the broadest sense to circulate in various platforms, languages, and various programs.

4.XML is a syntax for defining data and the original data, which allows you to define the data itself. This is one of the most important attributes of XML, because theoretically, anything can be used to describe the data. That is, because XML provides a way of describing data, it has the ability to describe anything.

As for the application of XML, let's give a simple example to see its power.

Most of today's websites are written in HTML. Web Designers ' well-designed Web pages can be beautifully displayed in a Web browser, but if you want to redesign the content of these pages in a book, it is clear that the beautiful content on the browser is not easily reflected in the book. We know that HTML is a poorly structured language that combines display and content tightly, and it is difficult to separate content selectively from HTML files, especially in beautifully designed pages. Perhaps the only way to do that is to redesign it. However, the advent of XML provides a good solution to this problem.

Because XML only defines data, it doesn't care about how the data is displayed, so the content and display of the Web site designed with XML is separate. A typical web page is generated after the transformation of a given XML document through XSLT. Now we want to put the content of the site in a book, only need to redefine the XSLT, given the rules of change, we can reproduce the content in another form of the perfect.

The above is just an important aspect of XML application, in fact, XML is now used more than that, and many protocols, such as soap, are xml-based.

The following is the specific XML programming. Since this article assumes that you have a certain understanding of the Java language (or other object-oriented language), there are no more details about the language.

Http://www.ccidnet.com/tech/code/011008/jxsource.zip

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.