473,403 Members | 2,323 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,403 software developers and data experts.

String interpreted correct?

How can I add a java String variable to an XPath expression?

Example:

String parent = "John";
String query =
"//Foundation.Core.Class[Foundation.Core.ModelElement.name='"+parent+"']/Foundation.Core.Gene
ralizableElement.specialization"

But it gives:
//Foundation.Core.Class[Foundation.Core.ModelElement.name='John']/Foundation.Core.Gene
ralizableElement.specialization"

which will not be interpreted correct by XPath.

How can I make sure that query is interpreted as:
//Foundation.Core.Class[Foundation.Core.ModelElement.name="John"]/Foundation.Core.Gene
ralizableElement.specialization"

BR

//Mikael
Jul 20 '05 #1
1 1233
hi,

try:

String query =
"//Foundation.Core.Class[Foundation.Core.ModelElement.name=\""+parent+"\"]/Foundation.Core.GeneralizableElement.specializatio n";

use \" if you need a " in a ""-string.

Regards,
Erwin Moller
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sathyashrayan | last post by:
Group, I have some doubts in the following program. ------------------program--------------------- /* ** Make an ascii binary string into an integer. */ #include <string.h> unsigned int...
46
by: yadurajj | last post by:
Hello i am newbie trying to learn C..I need to know about string comparisons in C, without using a library function,...recently I was asked this in an interview..I can write a small program but I...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
6
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards,...
111
by: Tonio Cartonio | last post by:
I have to read characters from stdin and save them in a string. The problem is that I don't know how much characters will be read. Francesco -- ------------------------------------- ...
84
by: Peter Olcott | last post by:
Is there anyway of doing this besides making my own string from scratch? union AnyType { std::string String; double Number; };
8
by: xmllmx | last post by:
It seems true, but I can't find any exact statement on this in the C or C++ standard. The C and C++ standard states: "__FILE_ The presumed name of the source file (a character string...
4
by: Chris Forone | last post by:
hello group, why have i to bracket the second ctor param in the following example? thx & hand, chris #include <fstream> #include <iterator> int main()
21
by: kumarvis | last post by:
int main () { char *str = *Aamit ; *str='R' ; printf("%s \n " ,str); } it's giving segfault why ?????
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.