473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

XPath showing NULL value.Please help.

Why is my xpath giving null for the the flwg

Expand|Select|Wrap|Line Numbers
  1. <Configuration>
  2. <Listener.Whiteboard>
  3.         <AQListener>
  4.             <Product>A</Product>
  5.             <Message.Class>XMLMessage</Message.Class>
  6.             <Database>
  7.                 <URL></URL>
  8.             </Database>
  9.         </AQListener>
  10. </Listener.Whiteboard>
  11. </Configuration>
  12.  
  13.  
  14.  
  15. Java Code:
  16. ---------
  17.  
  18. 1) wbCL.initialise(m_config.getNode("/Configuration/Listener.Whiteboard"));
  19.  
  20. 2) private void initialise(Node confignode){
  21.  
  22.    XPath xpath = XPathFactory.newInstance().newXPath();
  23.    Node listenerconfignode = (Node)xpath.evaluate("AQListener",confignode, XPathConstants.NODE);
  24.  
  25.    }                                
  26.  
  27.  
  28.  
Why is the listernerconfignode being set to NULL?
Am i missing something?
May 16 '07 #1
3 1572
dorinbogdan
839 Expert 512MB
Check if confignode is null, it may be incorrectly set.
Eventually try to use document node instead of confignode, and build the xpath as "Configuration/Listener.Whiteboard/AQListener"
May 16 '07 #2
The confignode is correctly set as when I say:

Expand|Select|Wrap|Line Numbers
  1. String szproduct = xpath.evaluate("AQListener/Product/text()", confignode);
  2. System.out.println("szproduct  " + szproduct);
  3.  
  4. Output: EQ.D
  5.  
May 16 '07 #3
Product : A and (not EQ.D) my mistake
May 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
8
by: Lawrence Oluyede | last post by:
Is there a way to treat html tags like simple text? I explain myself, if I have a bunch of xml like <content type="application/xhtml+xml" xml:base="http://loluyede.blogspot.com" xml:lang="en-US"...
5
by: Chua Wen Ching | last post by:
Hi, I read from this tutorial at codeproject Question A: http://www.codeproject.com/csharp/GsXPathTutorial.asp regarding xpath.. but i try to apply in my situation, and can't get it...
2
by: Richard | last post by:
Hi, I am trying to use an XmlDocument object to manipulate the default database instance node of the enterprise template library dataConfiguration section from a custom installer step: <?xml...
3
by: Goran Djuranovic | last post by:
Hi All, Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this: <Root> <Customer> <Name>MyName</Name> </Customer>...
9
by: DBC User | last post by:
Hi, I have an xml and I am able to use xpath to identify each node that statisfy the selection criteria. I got the node list. I would like to know is it possible to do the following for the...
2
by: Claudio | last post by:
Hi I'm trying to use XPath queries with streaming XML, but I cannot make it working. The solution I'm trying to implement is: create a XmlNode as soon as I have a full XML element and use the...
2
by: ajayreddy2105 | last post by:
Hi All, I want to build the xpath expression dynamically in the xsl for for-each. Scenario is like this:: 1. From javascript I am sending the parameters to xsl. 2. In xsl I am taking those...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.