 |
|
|
 |
| Web Services |
 |
| April 2003 |
 |
| DeveloperNet University Course |
 |
 |
| Reader Rating |
 |
|
 |
from ratings |
 |
|
 |
|
|
Exercises
Exercise 1: Write a Simple XML Document
In this exercises, you will create an XML document with the data provided below. This skill is important as you plan for the exchange of data in your Web Service. As you write an XML document, keep in mind that the element names should be descriptive of the data they describe and short.
Create Java Programs Written by: Jeff Fischer Topic: Beginning Java ISBN: 1-555-2555
Creating Better Java Programs Written by: Jeff Fischer Topic: Intermediate Java ISBN: 1-555-2556
Creating the Best Java Programs Written by: Jeff Fischer Topic: Advanced Java ISBN: 1-555-2557
Creating Java Web Services Written by: Jeff Fischer Topic: Web Services ISBN: 1-555-2558
- Open Notepad or some other text editor.
- Type in the XML declaration first.
<?xml version="1.0" encoding="ISO-8859-1"?>
- Analyze the data that you need to represent in the XML document and decide what it is you are trying to represent.
- Since we are going to represent data from a book catalog, let's use catalog as the name for the root element of the XML document.
- Type <catalog>
- Since the data we have is for a book, we will use book for the child element name.
- Type <book>.
- Type <title>Create Java Programs</title>
- Type <author>Jeff Fischer</author>.
- Type <topic>Beginning Java</topic>.
- Type <isbn>1-555-2555</isbn>.
- Type </book>.
- Repeat steps 7-11 for each book.
- Type </catalog>.
- Save the document as catalog.xml.
You should now be able to open the document in Internet Explorer and see the structure of the document.
|