Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2006, 11:55 PM
Authorized User
 
Join Date: May 2006
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing data From a node

Hi i have a small problem. my XML File is as follows:

Code:
<Assets>
 <Asset Code="30097" >
  <Level Code="30091" TagName="MarketCap"/>
  <Level Code="30092" TagName="Sector"/>
 </Asset>
</Assets>
I have to access the TagName from my java program using a dom4j object.(This document is in dom4j format).

I have the Asset Code 30097 and the code for the Level as 30091. how can i access the TagName.
i have tried using the following :

 domObj.valueOf ("//Assets/Asset[@Code='" + iAssetCode + "']/Level[@Code='" + iLevelCode + "']/@TagName");

plz help.

Thanks




 
Old June 7th, 2006, 02:16 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your XPath expression looks fine to me. But I'm not familiar with DOM4J's XPath interface. Can you get simpler XPath expressions to work?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing Node (Node data) pashworth XSLT 3 January 29th, 2007 12:39 PM
Accessing values from the last sibling node graywoodhouse XSLT 3 October 29th, 2004 06:15 AM
How do I get Data from the previous node? runeteacher XSLT 5 October 13th, 2004 03:55 AM
Extract Data From Node ryanpatrick XML 1 February 18th, 2004 10:31 AM
Accessing XML Node with multiple namespaces bamirzada C# 0 August 14th, 2003 07:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.