I read up on how to write the expression, but after trying I can't get any results. So eventually after double checking examples over and over I tried my best test expression in an online evaluator, copying it right out of workflow along with the same XML test data and it works. Is there different versions of the Xpath language?
Question
Question
Replies
Chad,
Interesting! I recreated your XML file (minus the namespace info) and it works as expected.
If I add the namespace info it fails...
Aha! I started narrowing it down bit by bit until it matched your screenshot, it was the below line of code in the XML file that is preventing it from working BUT it doesn't cause any problems with this website I am using as an alternative ???
That is just an extra parameter in the node, which should be legal.
For example I could have a node named <book> but I could also have a book with a category <book category="cooking">
Here is what I had to remove to get it to work: xmlns="http://tempuri.org/CDPlusDataSet.xsd"
That's because Workflow assumes the default namespace has an empty prefix. This snippet is modifying the default namespace.
So you need to be more specific now:
/*[name()='CDPlusDataSet']/*[name()='DistributionJob'][1]/*[name()='DocumentID']
I can't speak for other websites and their implementation, it's possible they chose to ignore namespaces. Workflow went for the more strict interpretation because usually namespaces are used to distinguish between fields with the same name, so we wanted to minimize the chance of getting the wrong data in an unattended process.
You can add extra namespaces to the activity from its advanced properties ("gear" button at the top right of the properties pane in the activity properties).
It has been working by manually removing this line of code xmlns="http://tempuri.org/CDPlusDataSet.xsd"
But I tried setting up the XML namespaces from the gear on the upper right just now, it says No Namespaces Could Be Found when I choose to Detect namespaces, so it appears these documents do not have a namespace at all.