| | | Supreme Being
       
Group: Forum Members Last Login: Monday, July 27, 2009 Posts: 13, Visits: 21 |
| | Hi, I am trying unsuccessfully to make use of the GetXmlNode function to get me a value of a certain column in a sharepoint list I have as an xmlVariable in my workflow. this: CurrentContext.XmlVariables["Proc"].RawXml gets me something like this: <?xml version="1.0"?> <List> <ListItem> <Proc_Y> <fieldname_x>text I want to get</fieldname_x> ... </ListItem> </List> So I Figured I could get the value like this: XmlNode node = CurrentContext.XmlVariables["Proc"].GetXmlNode("/List/ListItem/Proc_Y/fieldname_x"); For some reason, this doesnt seem to get there... I'd apreciate if if someone tells me what I'm doing wrong. |
| | | | Supreme Being
       
Group: Forum Members Last Login: Monday, December 21, 2009 Posts: 102, Visits: 124 |
| | Hi, In the below piece of code, I suggest you to add another an additional / and then test the sceanario. Your code: XmlNode node = CurrentContext.XmlVariables["Proc"].GetXmlNode("/List/ListItem/Proc_Y/fieldname_x"); Recommended code: XmlNode node = CurrentContext.XmlVariables["Proc"].GetXmlNode("//List/ListItem/Proc_Y/fieldname_x"); Also, please find attached a word document(XMlVariableUsage.doc) which might help you on this. Do get back to us for any further clarifications. Thanks, Sri
Srinivasa Rao Pentapati
|
| | | | Supreme Being
       
Group: Forum Members Last Login: Monday, July 27, 2009 Posts: 13, Visits: 21 |
| | Hi Sri, Thanks for your answer. i'll only be able to test it tomorrow, however, I think I have tried the double slash at the root of the xpath. I also tried doing a foreach loop from an XMLVariableCollection (taking the value of the RawXML from the "PROC" variable, that resulted in only 1 iteration (of course, silly me) but what I WASNT expecting is that instead of something like "//List" or "List" it was "$$List". I'm wondering if the Xpath is formatted diferently because it is accessing a Sharepoint list "directly". (Thanks for the Document, it will come in handy) |
| | | | Supreme Being
       
Group: Forum Members Last Login: Monday, July 27, 2009 Posts: 13, Visits: 21 |
| | (Later) Ok, I think I was able to narrow something down. on the Sharepoint list, the column name I want to access is "PROC Y" which in "sharepointish" is represented as: "Proc_x0020_Y" And it appears exactly like that in the xml if I do a rawxml dump. If I try to access "/List/ListItem", no problem. I get the node. But if I go deeper and try to access "/List/ListItem/Proc_x0020_Y" it busts, with something like this: System.Exception: Error while Getting Xml Node from Xml Variable-Proc-'/List/ListItem/Proc Y' has an invalid token. Notice that the _x0020_ that was present in the rawXML seems to have been converted (or decoded). But I cant seem to access it like: "Proc Y", "Proc%20Y", "Proc_x0020_Y" or "Proc%95x0020%95Y". Any idea how its getting encoded (im assuming) and how to access it? |
| | | | Supreme Being
       
Group: Forum Members Last Login: Monday, July 27, 2009 Posts: 13, Visits: 21 |
| | Anyway, I worked around it... XmlDocument oDoc = new XmlDocument(); oDoc.InnerXml = CurrentContext.XmlVariables["Proc"].RawXml; Using the XmlDocument from then on, was easy, and I got to the info I needed without any further problems. There is something with the encoding in the Skelta version of the Xml Variables that was preventing me from accessing the info directly... |
| | | | Supreme Being
       
Group: Forum Members Last Login: Monday, December 21, 2009 Posts: 102, Visits: 124 |
| | Hi, Thanks for letting me know that you got it working. Please feel free to post your queries through Skelta forum or alternatively you can mail to support@skelta.com . Thanks, Sri
Srinivasa Rao Pentapati |
| |
|
|