aspose file tools*
The moose likes XML and Related Technologies and the fly likes Help with XPATH expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Help with XPATH expression" Watch "Help with XPATH expression" New topic
Author

Help with XPATH expression

Jay Allen
Greenhorn

Joined: Jun 17, 2005
Posts: 2
Could someone please help find the right xpath expression to get the needed node.

I'm trying to get the //parameterValues/item[name='Group']/item/use

I've setup a prefix for the namespace and my matching is working fine on simple queries...this one I'm just messing up the syntax or something.

Essentially I'm trying to get the value: 324980

Here's the XML:

<?xml version="1.0" encoding="utf-8" ?>
- <!--
Copyright (C) 2004 Cognos Incorporated. All Rights Reserved.
Cognos (R) is a trademark of Cognos Incorporated.


-->
- <!--
Experimental.
Product features described in this file may not be supported in future releases.


-->
- <outputDescriptor xmlns="http://developer.cognos.com/schema/OutputDescriptor/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://developer.cognos.com/schema/OutputDescriptor/1.0/OutputDescriptor.xsd">
<asOfTime>2005-03-28T14:25:46.702Z</asOfTime>
<burstKey>CENTENE MANAGEMENT (324980)</burstKey>
<contact />
<defaultDescription />
<defaultName>2005-03-28T14:45:20.075Z</defaultName>
<fileName>511_1112042720076.pdf</fileName>
<locale>en-us</locale>
<owner>SCHLOSA</owner>
<ownerNamespace>ADS</ownerNamespace>
- <parameterValues>
- <item>
<name>Group</name>
- <value>
- <item xsi:type="simpleParmValueItem">
<inclusive>1</inclusive>
<display>324980</display>
<B><use>324980</use></B>
</item>
</value>
</item>
- <item>
<name>StartDate</name>
- <value>
- <item xsi:type="simpleParmValueItem">
<inclusive>1</inclusive>
<display>Jun 1 2004</display>
<use>2004-06-01T00:00:00.000</use>
</item>
</value>
</item>
- <item>
<name>Months</name>
- <value>
- <item xsi:type="simpleParmValueItem">
<inclusive>1</inclusive>
<display>9</display>
<use>9</use>
</item>
</value>
</item>
</parameterValues>
<reportSearchPath>/content/package[@name='Client Reporting - New']/report[@name='Client Report Card']</reportSearchPath>
<reportViewSearchPath>/content/folder[@name='Large Client Report Views - Parent']/reportView[@name='Report View of Client Report Card']</reportViewSearchPath>
</outputDescriptor>

Thanks for the help.
Jay Allen
Greenhorn

Joined: Jun 17, 2005
Posts: 2
Just figured it out. I needed to use my namespace in the brackets.

//prefix arameterValues/prefix:item[prefix:name='Group']/prefix:value/prefix:item/prefix:use

Hope this helps someone in the future...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with XPATH expression