Jump to content

HTML Email and XML


nyp22
 Share

Recommended Posts

Hi All,We would like to Use parse XML and JSP and generate HTML that we could use to send HTML email. We used XSL previously and we would like to avoid using the same since there is some learning curve involved for writing XSLT and it has some limitations.I can think following steps:1. make URL connection using HttpURLConnection to a servlet, post XML as a request parameter.2. Build XML object, may be DOM3. In the servlet I could use the RequestDispatcher's include method and pass the XML object to the JSP as an attribute.4. In the JSP I could use th XML Object to generate HTML.5. The result of the URL post could be read HTML. But I wonder is there is cleaner and a simpler way of creating HTML out of JSP using an existing framework or any other easy way to program. I appreciate your input on the same.Thanks in advance!

Link to comment
Share on other sites

Well, actually, if you ask me, the learning curve of DOM, as well as the code you get in the end is always more verbose and complicated then XSLT. Not to mention migration to another S3L will cause complete rewrite.Whatever limitations you think XSLT has, you can probably overcome them by doing the same with JSP and passing the result as a parameter to the XSLT processor. If it's a "natural" XSLT limitation of parsing the XML, I'm happy to tell you Saxon - one of the current two XSLT 2.0 processors - is available for JAVA, which should probably ease integration with JSP. XSLT 2.0 provides new easier methods of grouping, allows definitions of custom functions and allows the use of XPath 2.0 which has much new functions available to it. In short: it rocks.If you still want to use DOM after trying Saxon, well... doesn't JSP support the query() and evaluate() methods? I know PHP does, and it's very easy to select whatever you need that way. Note that Saxon also provides XQuery API, which allows XQuery 1.0 to be used inside JSP. XQuery itself uses XPath 2.0 as it's main constructor, so using XQuery would be just as easy.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...