Petterson Mikael
Usenet Archive
- Joined
- Nov 27, 2002
- Messages
- 89
- Reaction score
- 0
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
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