XML and Java: a powerful combination

Source: Internet
Author: User
Tags class generator object model pack xml parser xsl
XML XML is an acceptable specification when it was first presented by the WWW Group ( W3C) in November 1996. Now, it is essentially a combination of Java--that is, translating XML-related code parts of Java programs and parts of Java Semantics (motion) coding into XML tags that promise to provide simpler and more creative application computing to the enterprise or higher levels. larry cable  and  Mark Reinhold  are two veteran engineers at Sun, their "XML on the Java platform" at the recently held JavaOne developer conference. The Technical Meeting section spoke, according to their statements, that the main reason for this technical marriage is that xml-based syntax provides a flexible, standard, robust Java programming scenario, while Java also applies a common semantic set to XML data.   Why use XML?   Many of the information available in the electronic world is not stored and expressed as images, three-dimensional graphics, movies, sounds or other easily accessible multimedia formats, instead it exists in the form of text-based text where the web, databases, and other text are likely to exist. XML allows developers to consider and interpret their data in context in a standard structure so that, at each time of addition and update, a dataset in an XML framework can be combined with a dataset in another XML framework without rebuilding the entire structure. How does Java fit into this blueprint?   XML provides a common syntax for Java Semantics (behavior), which simply means that a developer can create descriptions for different data types so that the data behaves differently in Java program code, and can be reused and modified later. Since both Java and XML are portable standards, the results of the combination of these two technologies are portable and can be reused for data and porting behavior. All the potential that can be gained by using XML or Java alone is not fully mastered, and combining them into a vast new country. Now, the two main applications of applying XML to Java are the presentation oriented publishing industry and the message-oriented middleware technology in the enterprise. In particular, XML can be combined with Java to produce applications such as complex Web documents, dynamic Publishing, E-commerce, enterprise application integration, and structure information management and retrieval. XML standard extended XML standard extension is a fundamental exploration, which is used to translate XML syntax into java. The technical and architectural details of this exploration are still in the process, and Java developers can use this standard extension to build xml-based applications by the end of 1999. This standard extension includes some components: a parser, parsingnamespace supports XML's Simple API (SAX) and Document Object Model (DOM). A parser is a software module that is used to parse or read data from an XML document and check its validity. A namespace, part of the XML specification of the consortium, that defines a set of different XML tag elements in a document type definition (DTD). The primary benefit of namespaces is that it allows multiple variables to be mixed in a single document instance (in different tag sets and behaves differently).   Obviously, in order to gain this benefit, the parser must support namespaces, and Sun microsystems is still working on this support. SAX, a free, platform-and language-independent API defined for event-based XML parsers, allows programs and scripts to dynamically access and update content, structure, and document styles.   Therefore, it is used as a middleware layer to interpret the data in an XML document as a corresponding Java event.   DOM provides the parser with a tree-based data structure interface that builds XML data into objects and allows objects to be combined, accessed, manipulated, for example, through Java programs. The common drafts and alpha distributions of the XML Standard extensions specification will be available in the third quarter of this year (1999) and Sun intends to release the final version in the fourth quarter.   When all these issues have been eliminated, Sun plans to consider support for transition languages (transformation language) and Style page (XSL) and XML query languages, which allow querying of XML documents. XML data Binding standard extensions sun and other Xml-java advocates agree that XML standard extensions are not enough for efficient use of XML and Java. Although XML can provide the syntax for the data used by Java and follow this syntax, it is said that the syntax of the XML message is inherently meaningless, and it lacks specific knowledge of what a piece of data is and how it fits into the entire information system. The data binding standard extension, which uses schema (schemas), is a child specification of XML that describes the specific institutions and data types used by XML documents. Java programmers can relate to this similarity: An XML message inherits from an XML schema, which is the same as a Java object is an instance of a Java class. Schemas add meaning to them by constraining the structure and content of XML documents and data, and by describing the conceptual meaning, a person, not just a machine, can know what it does by simply browsing its structure. Understanding patterns are just the beginning of data binding, according to Cable and Reinhold, to get more from the Xml-java structure and programming mix, from Object mapping to XML message components (UnmarsHaling) is as important as mapping back objects (marshaling).   For XML message components that map and reflect the Java code, there are classes that are useful to them, and cable and Reinhold feel that neither sax nor DOM can solve the problem. But binding can solve this problem, at least theoretically. Use bindings to compile XML Schemas into Java classes, allowing objects to be mapped to and from XML messages arbitrarily. Bindings produce classes that encompass mapping and mirroring of the code (allowing perfect error and legitimacy checks) and accessing the component's methods (get and set), making the data element automatic and pattern consistent. binding XML to Java programs also eliminates the need for written reflection (Unmarshal) and reduces the likelihood of entering erroneous data. Sun's engineers are going to add one such binding tool to the Java platform, even though they have not yet announced a specific date.   Try it now   you can now download the binary code or source code for the java project x technology second release, java project x  technology is a name based on the Java-xml Technology Service pack. The service pack includes a fast XML parser with optional authentication and an object model tree in memory that supports w3c dom level 1  recommendations. According to Sun's java project x faq,project x  is a "development of XML-oriented applications and services of high-performance, modular, scalable Java api",   Try to prove it is true. Sun and other XML-bullish industries   not just sun, some technology developers are also building XML and Java bridges for their partners and customers. For example, bluestone software companies, which focus on enterprise interaction management, support the Java Standard extensions of XML in their Bluestone xml toolset. Netpost is a company that uses the Java component model to develop and deliver Cross-media publishing solutions that use XML for all data in their information systems as a "comprehensive standard data representation".   Oracle has also developed a number of products in this area, including Java XML parsers, XML class generator, and Java XSL processors. It is also useful for a Java developer to learn XML or at least explore it.。 Sun's engineers have already used XML in the JAVA2 platform. For example, XML has been used in JAVAHELP API to describe Meta information, and it is also used to describe the deployment descriptor in EJB1.1, which provides the syntax basis for the Java-EE programming model by interpreting EJB to JSP (or vice versa). Sun is also actively involved in the consortium and other Open XML organizations such as xml.org  and Oasis (the organization forthe advancement of  Structured information standards).

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.