I want to get the success value from the xml below:
<PIEngineResponse xmlns="http://www.pervasive.com/">
<success>TRUE</success>
<proxyId>10.10.90.15_test_user{3312564C-6A06-533B-52F0-C8F97C413137}</proxyId>
<engineName>PIEngineController_Engine_245</engineName>
<response>
<NOSDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:NOSDocument" xsi:schemaLocation="NewNosXML.xsd">
If I use xpath, I get:
/tns:PIEngineResponse/tns:success
Which causes the error:
Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.
What can I do to get the success value to avoid this error? Or how could I avoid the original error?
EDIT: Still no luck with code as:
using (TextReader r1 = File.OpenText(localFilePath))
{
XmlReader r = XmlReader.Create(r1);
XDocument doc = XDocument.Load(r1, LoadOptions.None);
XNamespace ns = "http://www.pervasive.com/";
string successValue = (string) doc.Root.Element(ns + "success");
}
ignore naming conventions for now.