Manage Ezine with JavaMail and XSLT

zhaozj2021-02-16  87

This way, you have learned XML. And has gradually mastered DTD, XSLT, SAX, and DOM. You have unlocked the secret of the namespace and think that it has mastered the technique of difficult to understand. congratulations! So what should I do now? I learned from the feedback from the developer, not only one of you asked him. This article will give an answer through an actual application. It demonstrates how to automatically publish using Java and XML. I think, this will give you some encouragement. This article does not introduce XML. I assume that you are familiar with XSLT and have some concept of SAX grammar analysis. Even if you need the background knowledge of those topics, you may still want to read this article because it will motivate you to learn more new knowledge. But be sure to refer to the reference information section to learn the basic XML knowledge. XML ... and email? XML looks like it is a technology that is born and email partners. But don't worry, you may be surprised when you see this singular combination. As you might know, Eudora, Outlook, Netscape, and other new email clients allow you to send emails in HTML format. The initial email message is limited to plain text and is not supported, bold, slope or hyperlinks. The latest email client can identify HTML, so now you can now send a message in plain text format, or you can send a document with a variety of formats. This selection of this email format has issued a problem for the publisher of E-Zine. In fact, this option has played a role in developing various strategies in E-Zine issues to overcome their two biggest issues (striving for and retained subscribers). Unfortunately, subscribers have a strong position to support or oppose HTML email. Worse, some clients (including popular AOL 4.0 to 5.0) do not support HTML at all. Unless it is extremely careful, users who use those old email clients can only see some useless information. In general, E-Zine publishers do their best to think about readers. In the era of plain text, the savvy publisher will change the format of the article. Some people continue to maintain this good tradition in the HTML email era, and spare no effort to prepare two versions for each document: provide plain text for the old email client, and provide HTML versions for the new client. After I heard this, I macked, I thought of "XSLT style sheet". (This may be the exact signal I will succeed.) The principle is in this classic article, you will see XML, XSLT and some Java programming how to simplify work. In this process, you will use a variety of XML technology. Before you start, let's review: Of course, the first is XML itself. e-zine will be written in XML (more precisely, docbook). Docbook is a popular XML vocabulary for technical documents. XSLT is usually used to convert XML to HTML. That will solve half of the problem (ie, preparing the HTML version of E-Zine). Enhance the special text formatizer supported by text XSLT. In fact, as you understand, the primary demand for E-Zine is the best text. JavaMail, Send Email Standard Java API. Figure 1 demonstrates the relationship between these components. From left to right, the ultimate goal is to prepare a so-called multi-segment email with E-Zine's text and HTML version. Figure 1. Components in the solution interactively prepare emails involving two style sheets: an output text, another output HTML version. Text gauge auxiliary style sheet. JavaMail gets two copies and sends them to subscribers. The first part of this series focuses on text transformation.

转载请注明原文地址:https://www.9cbs.com/read-12826.html

New Post(0)