Archive for October, 2007

Java & XML, 2nd Edition Mike - Do (Business web hosting)

Wednesday, October 31st, 2007

Java & XML, 2nd Edition <% if (authorOrEditor) { %> Mike - Do you think the following sidebar is a little much? I could easily leave it out if it’s still clear without it. <% } %> This is not very structured, as the JSP block ends before the authorComment element begins; then a new block is appended after the element, which closes the brackets opened in the first JSP block. It is very easy to mismatch coding structures or forget to add matching JSP blocks. The XSP paradigm forces every open element to be closed (standard XML well-formedness) and one block of code is matched with one element. With these logical structures in place, the XSP page just needs to interpret the request parameters. You can use the built-in XSP variable request, which mimics the javax.servlet.http.HttpServletRequest object. The following code additions read the values of the userRole and password request parameters (if they exist). The value of userRole is then compared with the roles that can see the comments (”author” and “editor”). If a match occurs, the password is checked as well. If the password matches the key for the supplied role, the boolean variable is set to true, and the authorComment element is part of the XML output: boolean authorOrEditor = false; // Perform logic to see if user is an author or editor In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Java & XML, 2nd Edition Java and XML (Web hosting rating)

Wednesday, October 31st, 2007

Java & XML, 2nd Edition

Java and XML Book in Progress


Select your role:

Enter your password:

Also notice that this HTML submits the form data directly to your XSP page. In this example, the XSP acts like a servlet. It reads the request parameters, determines what user role was selected, authenticates that role using the password supplied, and finally determines whether the author comments should be shown. To begin, define a boolean variable; this variable holds the result of comparing the request parameters to see if the user is an author or editor and supplied a correct password. The value of the variable is checked, and if it is true, the authorComment element is displayed; surround the authorComment element with the XSP directives shown here: boolean authorOrEditor = false; // Perform logic to see if user is an author or editor if (authorOrEditor) { Mike - Do you think the following sidebar isa little much? I could easily leave it out if it’s stillclear without it. } This shouldn’t look strange; other than the XSP-specific tags, you’re just defining a variable and checking its value. If the variable evaluates to true, the authorComment element is added to the XSP page’s output; otherwise, the element is not included in the output. One interesting thing to note is that the actual XML document output is surrounded within the xsp:logic block with an xsp:content element (which in turn is within the outer xsp:page element), ensuring that the XSP processor does not try to interpret any elements or text within the block as XSP structures. The same code in JSP might look like this:
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Java & XML, 2nd Edition The comments appear (Web hosting reviews)

Tuesday, October 30th, 2007

Java & XML, 2nd Edition The comments appear slightly smaller than the rest of the text, italicized, and in red. Now it’s possible to turn your XML document into an XSP page (as in Example 10-9) by adding processing instructions for Cocoon and surrounding the elements within a new root element, xsp:page. Example 10-9. Turning chapterTen.xml into an XSP page Brett McLaughlin Before adding XSP logic to determine whether to show the comment, build a simple HTML page letting the viewer indicate if he is the book’s editor. In a real application, this could be a page that handles authentication and determines a user’s role; for this example, it lets the user select author, editor, or just a curious reader, and enter a password for verification. An HTML page that does this is shown in Example 10-10. Save this file as entry.html in your context’s document root. Example 10-10. Entry page for chapterTen.xml XSP page
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Java & XML, 2nd Edition fundamentals of using

Tuesday, October 30th, 2007

Java & XML, 2nd Edition fundamentals of using and creating XML itself. Now that you have a graspon using XML from your code, I want to spend time on specificapplications. The next six chapters represent the most significantapplications of XML, and, in particular, how those applications areimplemented in the Java space. While there are literally thousands ofimportant applications of XML, the topics in these chapters are thosethat continually seem to be in the spotlight, and that have a significantpotential to change the way traditional development processes occur. Mike - Do you think the following sidebar is a littlemuch? I could easily leave it out if it’s still clear without it. Readers of the first edition of this book will find that much of this chapter on Cocoon is the same as the first edition. AlthoughI promised you that Cocoon 2 would be out by now, and although I expectedto be writing a chapter on Cocoon 2, things haven’t progressed as quicklyas expected. Stefano Mazzochi, the driving force behind Cocoon, finallygot around to finishing school (good choice, Stefano!), and sodevelopment on Cocoon 2 has significantly slowed. The result is thatCocoon 1.x is still the current development path, and you should stickwith it for now. I’ve updated the section on Cocoon 2 to reflect what iscoming, and you should keep an eye out for more Cocoon-related books fromO’Reilly in the months to come.
I’ll begin this look at hot topics with the one XMLapplication that seems to have generated the largest amount of excitementin the XML and Java communities: the web publishing framework. AlthoughI have continually emphasized that generating presentation from contentis perhaps over-hyped when compared to the value of the portable datathat XML provides, using XML for presentation styling is still veryimportant. This importance increases when looking at web-basedapplications. With this comment in your XML document, add a corresponding entry into your XSL stylesheet, JavaXML.fo.xsl :
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Java & XML, 2nd Edition Thus, XSP easily (Web site templates)

Monday, October 29th, 2007

Java & XML, 2nd Edition

Thus, XSP easily handles the first major problem of JSP: it separates content from presentation. This separation allows developers to handle content generation (the XSP page can be generated from a servlet or other Java code as well as being static), while XML and XSL authors can handle presentation and styling through modification of the XSL stylesheet applied to the XSP page. Just as easily, XSP solves the other significant deficiency of JSP: because XSP processing occurs before any stylesheets are applied, the resultant XML document can be transformed into any other format. XSP maintains all the advantages of XML, as the XSP page can be transferred between applications as well as being used just for presentation. 10.4.1 Creating an XSP Page Now that you have had a taste of XSP, you can build your own XSP page. For this example, I’ll continue looking at the XML documents already created. Let’s revisit the XML document constructed earlier. This document represents a portion of this chapter and was transformed into a PDF document. Instead of simply using this document for display, assume that the author wants to let his editor view the document as it is being written. However, in addition to the text of the book, the editor should be able to see comments from the author that the public should not see: for example, questions about style and formatting. First, add the following comment to the chapterTen.xml file you built earlier: Brett McLaughlin
This chapter begins looking at specific Java and XMLtopics. So far, I have covered the basics of using XML from Java, looking at the SAX, DOM, JDOM, and JAXP APIs to manipulate XML and the
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Web hosting providers - Java & XML, 2nd Edition does not really

Monday, October 29th, 2007

Java & XML, 2nd Edition does not really provide a separation of content and presentation. This is the same problem I have been talking about: changes to a banner, font color, or text size require the JSP (with the inline Java and JavaBean references) to be modified. JSP also mingles content (pure data) with presentation in the same way static HTML does. Second, there is no ability to transform the JSP into any other format, or use it across applications, because the JSP specification is designed primarily for delivery of output. XSP remedies these problems. XSP is simply XML at its heart. Take a look at the sample XSP page in Example 10-7. Example 10-7. A simple XSP page private static int numHits = 0; private synchronized int getNumHits( ) { return ++numHits; }

I’ve been requested getNumHits( ) times.

All XML conventions are followed. For now, think of the xsp:logic element content as “offlimits” to the XML parser; I’ll discuss that later. Other than that, the entire document is simply XML with some new elements. In fact, it references an XSL stylesheet that has nothing remarkable about it, as you can see in Example 10-8. Example 10-8. XSL stylesheet for the XSP page type=”text/html”
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Ftp web hosting - Java & XML, 2nd Edition Figure 10-7. WML

Sunday, October 28th, 2007

Java & XML, 2nd Edition Figure 10-7. WML table of contents Visit http://www.openwave.com/ and http://www.wapforum.org/ for more information on WML and WAP; both sites have extensive online resources for wireless device development. By now, you should have a pretty good idea of the variety of output that can be created with Cocoon. With a minimal amount of effort and an extra stylesheet, the same XML document can be served in multiple formats to multiple types of clients; this is one of the reasons the web publishing framework is such a powerful tool. Without XML and a framework like this, separate sites would have to be created for each type of client. Now that you have seen how flexible the generation of output is when using Cocoon, I will move on to how Cocoon provides technology that allows for dynamic creation and customization of the input to these transformations. 10.4 XSP XSP stands for Extensible Server Pages, and is perhaps the most important development coming out of the Cocoon project. JavaServer Pages (JSP) allows tags and inline Java code to be inserted into an otherwise normal HTML page; when the JSP page is requested, the code is executed and the results are inserted right into the output HTML.2 This has taken the Java and ASP worlds by storm, ostensibly simplifying server-side Java programming and allowing a separation of output and logic. However, there are still some significant problems. First, JSP This is a drastic oversimplification; the JSP is actually precompiled into a servlet, and a PrintWriter handles output. For more information on JSP, refer to JavaServerPages by Hans Bergsten (O’Reilly).
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Java & XML, 2nd Edition This is understood (Php web hosting)

Sunday, October 28th, 2007

Java & XML, 2nd Edition This is understood perfectly by a WAP browser. If you’ve downloaded the UP.SDK browser, you can point it to your XML table of contents, and see the results. Figure 10-6 shows the main menu that results from the transformation using the WML stylesheet when a WAP device requests the contents.xml file through Cocoon. Figure 10-6. Main menu for Java and XML In the UP.SDK browser versions that I tested, the browser would not resolve the entity reference OReillyCopyright. I had to comment this line out in my XML to make the examples work. You will probably have to do the same, until the simulator fixes this bug. Figure 10-7 shows the generated table of contents, accessed by clicking the “Link” button when the “Contents” link is indicated in the display.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Java & XML, 2nd Edition Copyright 2000, O'Reilly

Saturday, October 27th, 2007

Java & XML, 2nd Edition

Copyright 2000, O'Reilly & Associates


Contents
.

Other than the WML tags, most of this example should look familiar. There is also a processing instruction for Cocoon, with the target specified as cocoon-format. The data sent, type=”text/wml”, instructs Cocoon to output this stylesheet with a content header specifying that the output is text/wml (instead of the normal text/html or text/plain). There is one other important addition, an attribute added to the root element of the stylesheet: By default, any XML namespace declarations other than the XSL namespace are added to the root element of the transformation output. In this example, the root element of the transformed output, wml, would have the namespace declarations associated with the javaxml2 and ora prefixes added to it: This addition causes a WAP browser to report an error, as xmlns:javaxml2 and xmlns:ora are not allowed attributes for the wml element. WAP browsers are not as forgiving as HTML browsers, and the rest of the WML content would not be shown. However, you must declare the namespace so the XSL stylesheet can handle template matching for the input document, which does use the javaxml-associated namespace. To handle this problem, XSL allows the attribute exclude-result-prefixes to be added to the xsl:stylesheet element. The namespace prefix specified to this attribute will not be added to the transformed output, which is exactly what you want. Your output would now look like this:
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Java & XML, 2nd Edition Welcome to my

Saturday, October 27th, 2007

Java & XML, 2nd Edition Welcome to my Title Page!
So happy to see you.

Hello World!

This simple example serves requests with a menu, and two screens accessed from links within that menu. The complete WML 1.1 specification is available online, along with all other related WAP specifications, at http://www.wapforum.org/what/technical_1_1.htm. You can also pick up a copy of Learning WML and WML Script by Martin Frost (O’Reilly). Additionally, the UP.SDK can be downloaded from http://www.phone.com/products/upsdk.html; this is a software emulation of a wireless device that allows testing of your WML pages. With this software, you can develop an XSL stylesheet to output WML for WAP devices, and test the results by pointing your UP.SDK browser to http://:
/contents.xml. Because phone displays are much smaller than computer screens, you want to show only a subset of the information in our XML table of contents. Example 10-6 is an XSL stylesheet that outputs three cards in WML. The first card is a menu with links to the other two cards. The second card generates a table of contents listing from our contents.xml document. The third card is a simple copyright screen. This stylesheet can be saved as JavaXML.wml.xsl in the XSL/ subdirectory of your Cocoon context. Example 10-6. WML stylesheet type=”text/wml”


Contents
Copyright


Visit our web design programs services for an affordable and reliable webhost to suit all your needs.