Home > Articles > Programming > Java

This chapter is from the book

Final Comparative Discussion

Short of the use of simple id attributes and span tags for substring manipulation, XMLC is a presentation technology that is completely transparent to anybody viewing a markup page about to be processed in the XMLC environment. It achieves this by turning the page into a DOM structure, then manipulating the structure. It is, however, more than direct DOM manipulation. As a compiler, XMLC offers significant capabilities and conveniences that greatly simplify the tasks of the designer, the Java developer, and the application architect. A couple of features have been reviewed in our previous two chapters, with many more to be discussed in Chapter 6, "XMLC Basics."

Clearly, standard servlet programming, JavaServer Pages programming, XSLT programming, and Cocoon/XSP programming have something for just about everybody. We now have sufficient context with respect to these technologies to makes some observations about XMLC. In this section we're going to use the context of this chapter to make some assertions about XMLC programming, and bring to light advantages of XMLC that are made more clear when described relative to JSP and XSLT.

XMLC Views Markup Pages as Template Object Representations

By accessing markup through the DOM API, XMLC views all markup as object-oriented resources that can be manipulated with a minimum of markup idiosyncrasies. The DOM library insulates the Java logic from the need to understand markup language conversion issues, such as how to replace ampersand characters with the appropriate entity references. Letting the DOM represent the page, there's no JSP or XSP embedded logic that looks like

if (( request!= null && (e.hasMoreElements()))...

Finally, DOM development guarantees that well-formed XML documents are generated from the object representation.

XMLC Sticks with One Programming Language: Java

Cocoon and XSLT incorporate yet another language (or two) for project and product managers, and sometimes their customers, to consider. Debugging becomes complex and integration issues more difficult. With XMLC, you are operating with only one language, Java. Yes, there are the inevitable JavaScript issues for supporting client-side browser programming, but that's the case for all the presentation technologies discussed in this chapter. With XMLC, there is no new category of "page programmer," an intermediate between Java developer and the page designer.

Figure 3.4 attempts to show by relative position on a triangulation of Java, DOM, and XSL programming where the presentation technologies we've discussed might lie. Clearly, JSP is the most Java-centric. But, without DOM support, JSP programming has had to engineer an alternative, non-standard strategy for generating HTML/XML content.

Figure 3.4 Relative use of Java and Scripting/XSLT templating.

XMLC Enables Type-Safe DOM Programming

Markup language-specific DOM sub-interfaces are incorporated with the XMLC environment. These include HTML, WML, VoiceXML, and cHTML. Unlike JSP, which relies entirely on the developer to construct the resultant markup page, markup language-specific libraries increase type-safe programming. XMLC has an escape hatch for those who aren't interested in leveraging markup-specific libraries. You always have the option to do standard DOM programming and still take advantage of the use of id attributes. This means that you can use XMLC for any type of markup language as long as it is based in XML.

XMLC Is a True Template Presentation Technology

With thoughtful designs on how to detect client types or preferred languages, XMLC supports the capability for Java servlets to load the appropriate DOM representation of a markup page. This template encapsulates the markup page, reducing the amount of Java logic required to generate the presentation page. Unlike JSPs, these templates never contain Java code.

As a template resource and lacking any embedded logic, the page has no impact on the flow of logic. It also eliminates the need for special tag elements representing the namespace for Java or XSLT code.

XMLC Greatly Simplifies DOM Programming

The use of developer/designer-chosen id attributes greatly simplifies the manipulation of DOM elements. XMLC uses the id values to auto-generate Java methods that the developer has the option of using. These methods bypass much of the DOM intrigue of traversing, removing, appending, and updating tree nodes and text elements.

XMLC Is Designer-Friendly

With JSP, a designer must maintain two documents: One with scriptlets embedded that will, eventually, populate a table with dynamically-gathered row data; and another that is the mock-up page, which shows what the page might look like when the application is operational.

With XMLC, the document used by the application and as the mocked-up page are one in the same. The XMLC compiler incorporates options that make it easy to remove mocked-up data during compilation.

And, of course, the designer never sees a lick of code. Other than accidentally changing an id attribute value, there's no chance to accidentally break the application. Even in the case of missing id attributes or renamed id values, the XMLC compiler includes options for validating ids.

XMLC Eliminates the Need to Introduce New Tags (Elements)

Again, XMLC keys off of id attributes. There is no need for taglibs. There is no need for scriptlets. The implication is that XMLC will work with any standard HTML or XML browser without having any required update to the list of supported elements.

XMLC Is a True Loosely Coupled, Object-Oriented Presentation Strategy

XMLC was designed to keep Web applications truly object-oriented. This was in reaction to the observation that JSP really let HTML do the steering, as it were. The absence of Java logic embedded in a markup page makes XMLC as loosely coupled as you can get when gluing two very differently purposed languages together: markup and Java. XMLC's avoidance of embedding logic in the markup makes XMLC programming more polymorphic. Any action can connect any page. There is no pre-knowledge of page and action, which is typically the case with JSP pages. Instead of the page calling code, the code calls the pages into memory.

With XMLC, you can string actions together to form a business process. Because XMLC doesn't depend on a series of visual clues, you can string them together differently on, for example, a per-user basis. An example might be the behavior defined for an average user as opposed to an administrator. Recognizing an administrator, the logic determines that another page requiring another type of login is to be loaded and displayed.

The XMLC Mechanism Is the Same for Everybody

Unlike JSP taglibs and XSP taglibs, XMLC introduces a standard relationship between the markup page and how it references Java logic "underneath." Attributes, not elements/tags, are defined by the programmer. There is no option for inserting Java logic directly in the markup page. Until there is a unified standard JSP or XSP custom tag library, the approaches taken by different parties to define custom tag interfaces will vary from organization to organization and product to product.

XMLC Detects Errors Early

XMLC identifies page creation errors during compile-time. Unlike JSP, XMLC detects malformed markup pages during the development phase. It is impossible to generate a malformed markup page when leveraging the DOM standard. XMLC development is much less error prone than JSP development. There is less opportunity for making errors as compared to JSP development, where the developer performs a specialized form of Java development—connecting JSP declarations, scriptlets, and expressions. And there is a much higher likelihood of understanding the error, because it is expressed in the context of standard Java, not JSP scriptlet-isms.

XMLC Is Built Heavily on Standards

Finally, although it is not a defined technology under J2EE, in many ways XMLC is actually more "standard" than JSP. XMLC leverages the XML and DOM standards, both defined by the World Wide Web Consortium. XMLC is also an open source technology, which for many, offsets its definition outside the J2EE specification.

Taglibs Do Not Make JSP Like XMLC

The most common response an XMLC developer hears in a discussion about JSP versus XMLC is "JSP can do that with taglibs." The reality lies somewhere between an answer of "Somewhat yes, and mostly no." For example, a designer-friendly JSP developer could create a custom tag that enables mocked-up data to be included in the body of the element, like XMLC does natively. But even this feature will be non-standard, as different implementers of different tag libraries do it differently.

The leveraging of HTML/XML elements to identify and install a new custom tag again forces a tight coupling between markup and logic. Not even XSLT defines new elements. Its elements are standard, thus guaranteeing a common language from implementation to implementation.

My observation is simply this: If you want extreme flexibility of strategies that you use to link markup presentation and logic, JSP is absolutely your choice. If you want to standardize on one strategy for achieving separation of presentation and logic, and you want it to be the same approach used by anybody else using that same technology, then XMLC is the route to take.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020