Hi all i am trying to use xpathQuery for the below xml data.
My xml file starts with assessmentItem. There is not even single character before assessmentItem >
The elements you are trying to match in your XPath query are in the namespace whose URI is "http://www.imsglobal.org/xsd/imsqti_v2p1". This is because on the top-level element there is a default namespace declaration:
xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
To match these elements, you have two choices:
define a namespace prefix for "http://www.imsglobal.org/xsd/imsqti_v2p1" and then use that prefix in your XPath expression before each element name, e.g.:
"imsq:assessmentItem/imsq:itemBody/imsq:matchInteraction/imsq:simpleMatchSet/imsq:simpleAssociableChoice/imsq:p/text()"
or
modify your XPath expression to be namespace-insensitive, e.g.
"//*[local-name() = 'simpleAssociableChoice']//text()"