How do I write and deploy a simple hello world program that uses XML and can be seen in a browser. What is the required software to start working with XML?

swarna kumar Reddy

Several people have contributed to answering this question:

From Thijs Stalenhoef
To answer you second question first:
A text editor is really all you need.
XML is a human-readable format which is a lot like HTML in *appearance*. As such you can create XML documents using a simple text-editor. Graphical tools for creating XML are available but not necessary.

Remember though that XML is "nothing more" then a way to describe data in structured way. A "hello world"-like program using XML doesn't really exist, as XML isn't a programming language.

If you want to use Java to output XML that can be viewed in a browser you should use Java Server Pages or a Java Servlet that outputs XML. You do this in a way analoguous to outputting HTML using JSP or Servlets.

From swarna kumar Reddy
To display XML file in a browser it requires corresponding XSL file.
Hello.xml is the XML file:


<?xml version="1.0"?>
<?xml:stylesheet  type="text/xsl" href="Hello.xsl"?>
<Greet>
 <wish>
 <info>Hello World</info>
 </wish>
</Greet>

Hello.xsl is the XSL file:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">
<html>
  <head>
  <title>  Hello World Application  </title>
  </head>
  <body>
  <xsl:for-each select="Greet/wish">
    <xsl:value-of select="info" />
  </xsl:for-each> 
  </body>
  </html>
 </xsl:template>
</xsl:stylesheet>
Now open the Hello.xml file in a browser that supports XML, such as IE 5.0.

From ganesh vednere
To deploy any XML program on a browser you would need to convert that XML into HTML. HTML conversion is performed by applying XSL templates on the XML document. This can be done on the browser (only for IE5) or by writing code to process the XSL and XML. Processors can be downloaded from the apache.org website. Look for Xalan /Xerces. The Xalan processor will process the XML and XSL and generate either HTML or XML. You can do this either at command line or by writing Java code on the server (e.g. servlet).

From Majid Imtiaz
I recommend the following to get fammiliar with XML codding. http://www-4.ibm.com/software/developer/education/xmlintro/xmlintro-1-4.html

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact