I have an XML document where i am using xpath to find specific nodes using the text.
For example the product that i am trying to find is the following product node in a file that has many product nodes.
<product>
<code>10023</code>
<name>
<value language="en_US">There's Pippins and Cheese to Come</value>
<value language="en_CA">There's Pippins and Cheese to Come</value>
</name>
</product>
I am using the xpath query
node = self.productDoc.xpath("/product[name/value[text() = '{0}']]".format(self.Title))
where productDoc = etree.parse(FileLocation)
from the Lxml module
My question is: when i try to select node with the xpath path provided above, i get invalid Predicate. I believe the problem is the single quote in the "There's Pippins and Cheese to Come" text which is messing with the xpath path. How do I overcome this?