May 2001
Intermediate to advanced
1088 pages
30h 13m
English
Because an XML document is simply a text file (or a stream of text), you can create one just by using a PrintWriter or even System.out.println. Listing 22.4 shows a simple Java program that prints out an XML document.
package usingj2ee.xml;
public class PrintXML
{
public static void main(String[] args)
{
System.out.println("<?xml version=\"1.0\"?>");
System.out.println("<greeting>");
System.out.println(" Hello XML World!");
System.out.println("</greeting>");
}
}
|
Obviously, there's nothing to printing out an XML file. Now, from a Java Server Page, you have one extra challenge. The content type for an XML page is different from the content type for an HTML page. ...
Read now
Unlock full access