Lotus Expeditor Toolkit, Version 6.1.x
Operating systems: Linux on x86, Windows

XML Parser sample

This sample creates a Client Services project to demonstrate how to use a Simple API for XML (SAX) parser to get information stored in XML files.

Time required: 2 minutes

Key concepts demonstrated in this sample are as follows:
  • Accessing a SAX Parser using the OSGi XML Parsing Service
  • Loading resources from Bundle objects
  • Preparing InputSource objects to enable DTD or Schema verification for resources contained in the bundle

Setup instructions

Before you can run the sample, you must first import the sample into your workspace and launch the test runtime.
  1. To import the sample:
    1. Select File > Import.
    2. From the Import Wizard, select General and then select Existing Projects into Workspace. Click Next.
    3. Select the Archive file radio button.
    4. Enter the name of the sample jar file, xmlparser.jar, or browse to the com.ibm.rcp.tools.samplegallery plug-in directory and select the jar file from the archive directory.
    5. The dialog shows the projects present in the archive jar file. Select Finish to install the projects into your workspace.
  2. To launch the test runtime:
    1. Select Run > Run from the main menu.
    2. Select Client Services and click New.
    3. Type a unique name for your configuration, such as XML Parser.
    4. Select the Plug-ins tab and verify that the com.ibm.rcp.samples.xmlparser plug-in is selected.
    5. Select the Arguments tab and verify that –console is in the Program Arguments field.
    6. Click Apply and then Run.
  3. To start the sample, enter start com.ibm.rcp.samples.xmlparser in the Console view.
    Note: To stop the sample, enter stop com.ibm.rcp.samples.xmlparser.
Output is similar to the following:
osgi> start com.ibm.rcp.samples.xmlparser

osgi> ***Begin Document***
[bookshelf]
	[TechnologyBooks]
		[Book]
			[Name]
				JAVA 2 Programming
			[/Name]
			[Price]
				$30.99
			[/Price]
			[TotalPages]
				325
			[/TotalPages]
		[/Book]
		[Book]
			[Name]
				J2EE Design and Development
			[/Name]
			[Price]
				$52.49
			[/Price]
			[TotalPages]
				583
			[/TotalPages]
		[/Book]
	[/TechnologyBooks]
[/bookshelf]
***End Document***


Library | Support | Terms of use |

Last updated: April 21, 2008
(C) Copyright IBM Corporation 2004, 2008. All Rights Reserved.
This information center is built on Eclipse. (http://www.eclipse.org)