XPATH Querying the XML from WebRowSet

Hi,

I have created the XML from WebRowSet (from Database)and stored to a String variable in the Program. I have used the SAX Parsing for parsing the String.

The Question I have is suppose i want to get the Name of the person in the IT department ? The Below XML does not allow me to use XPATH unless i restrict the query in the select statement. By using so, i will be restricted .

Pls help me to solve my question.

This is the XML i have created from the database :-

_

<?xml version="1.0"?>

<webRowSet xmlns="http://java.sun.com/xml/ns/jdbc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/jdbc http://java.sun.com/xml/ns/jdbc/webrowset.xsd">

<properties>

<command><null/></command>

<concurrency>1008</concurrency>

<datasource><null/></datasource>

<escape-processing>true</escape-processing>

<fetch-direction>1000</fetch-direction>

<fetch-size>0</fetch-size>

<isolation-level>2</isolation-level>

<key-columns>

</key-columns>

<map>

</map>

<max-field-size>0</max-field-size>

<max-rows>0</max-rows>

<query-timeout>0</query-timeout>

<read-only>true</read-only>

<rowset-type>ResultSet.TYPE_SCROLL_INSENSITIVE</rowset-type>

<show-deleted>false</show-deleted>

<table-name><null/></table-name>

<url><null/></url>

<sync-provider>

<sync-provider-name>com.sun.rowset.providers.RIOptimisticProvider</sync-provider-name>

<sync-provider-vendor>Sun Microsystems Inc.</sync-provider-vendor>

<sync-provider-version>1.0</sync-provider-version>

<sync-provider-grade>2</sync-provider-grade>

<data-source-lock>1</data-source-lock>

</sync-provider>

</properties>

<metadata>

<column-count>3</column-count>

<column-definition>

<column-index>1</column-index>

<auto-increment>false</auto-increment>

<case-sensitive>true</case-sensitive>

<currency>false</currency>

<nullable>0</nullable>

<signed>false</signed>

<searchable>true</searchable>

<column-display-size>70</column-display-size>

<column-label>name</column-label>

<column-name>name</column-name>

<schema-name></schema-name>

<column-precision>70</column-precision>

<column-scale>0</column-scale>

<table-name></table-name>

<catalog-name></catalog-name>

<column-type>1</column-type>

<column-type-name>CHAR</column-type-name>

</column-definition>

<column-definition>

<column-index>2</column-index>

<auto-increment>false</auto-increment>

<case-sensitive>true</case-sensitive>

<currency>false</currency>

<nullable>0</nullable>

<signed>false</signed>

<searchable>true</searchable>

<column-display-size>30</column-display-size>

<column-label>department</column-label>

<column-name>department</column-name>

<schema-name></schema-name>

<column-precision>30</column-precision>

<column-scale>0</column-scale>

<table-name></table-name>

<catalog-name></catalog-name>

<column-type>1</column-type>

<column-type-name>CHAR</column-type-name>

</column-definition>

<column-definition>

<column-index>3</column-index>

<auto-increment>false</auto-increment>

<case-sensitive>true</case-sensitive>

<currency>false</currency>

<nullable>0</nullable>

<signed>false</signed>

<searchable>true</searchable>

<column-display-size>11</column-display-size>

<column-label>Phone</column-label>

<column-name>Phone</column-name>

<schema-name></schema-name>

<column-precision>11</column-precision>

<column-scale>0</column-scale>

<table-name></table-name>

<catalog-name></catalog-name>

<column-type>1</column-type>

<column-type-name>CHAR</column-type-name>

</column-definition>

</metadata>

<data>

<currentRow>

<columnValue>Kevin ROss</columnValue>

<columnValue>IT department</columnValue>

<columnValue>123456789</columnValue>

</currentRow>

<currentRow>

<columnValue>Angelia Andrews</columnValue>

<columnValue>Shipping Department</columnValue>

<columnValue>5642389712</columnValue>

</currentRow>

<currentRow>

<columnValue>Kevin ROlfe</columnValue>

<columnValue>Physical Department</columnValue>

<columnValue>8971015723</columnValue>

</currentRow>

<currentRow>

<columnValue>Debbie Lis</columnValue>

<columnValue>Mainframe Department</columnValue>

<columnValue>8476984523</columnValue>

</currentRow>

</data>

</webRowSet>

[5988 byte] By [khtshyama] at [2007-10-3 4:33:01]
# 1
To get Name of the person in the IT department XPath expression is:/webRowSet/data/currentRow[columnValue[2]='IT department']/columnValue[1]
dvohra09a at 2007-7-14 22:36:34 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
No, it does not find the value needed.pls kindly reply
khtshyama at 2007-7-14 22:36:34 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Add text() to get the node text./webRowSet/data/currentRow[columnValue[2]='IT department']/columnValue[1].text()
dvohra09a at 2007-7-14 22:36:34 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...