[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1109
  • Last Modified:

XmlNode.SelectSingleNode and XPath issue

why does the below code not work in that :
- mynode is undefined ?
- yet in Break debug mode i can see the root nicely containing the Function child node that im trying to filter with with SelectSingleNode


XmlDocument^ doc = gcnew XmlDocument;
		doc->Load(fileNamePath);
		
		XmlNode^ mynode;
		XmlNode^ root = doc->DocumentElement;
		// i checked no problems with xml file path or the root document up to here !
		String^ MyXPathQuery = "descendant::LastCue[Function='Default']";
		mynode = root->SelectSingleNode(MyXPathQuery);
 
 
//My XML file (fileNamePath) contents are the following:
 
<?xml version="1.0" encoding="us-ascii" standalone="yes"?><LastCue><Function>Default</Function><Time>52592</Time></LastCue>

Open in new window

0
KristjanLaane
Asked:
KristjanLaane
1 Solution
 
BigRatCommented:
Because the Load operation is being performed asynchronously. Set XmlDoc.async to false.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now