The mysterious SourceCode.K2Utilities

  • 23 August 2007
  • 6 replies
  • 0 views

Badge +2

Hi


We have a couple of workflow applications that make use if the K2Utilities assembly particularly when interrogating xml data from InfoPath form schema.


For example we use SourceCode.K2Utilities.XmlFieldHelper to do things like:


XmlDocument xmlDoc = new XmlDocument();


SourceCode.K2Utilities.XmlFieldHelper XmlFieldHelper = new SourceCode.K2Utilities.XmlFieldHelper();


XmlFieldHelper.XMLDoc = xmlDocl;


RepeatingNode = XmlFieldHelper.get_XMLNode(xPath);


and:


myNodeList = SourceCode.K2Utilities.XMLFieldMod.GetXMLNodeList(K2XMLSchema, xPath);


However we've been informed by the guys at K2 that K2Utilities is actually not supported and we shouldn't really be using it at all in our applications. As I'm not that familiar with XML I'd like to know if there are any objects in C# we could use instead of the objects we currently use from the K2Utilities assembly?


 Many Thanks


Tim


 


6 replies

Badge +4

Hi Tim,


K2Utilities is not documented by K2. The code you are supporting is likely to have been generated by the wizard at some point. I looked into this a while back and as far as I could tell there was no other way to perform most of the tasks that the K2Utilities is used for. It is very difficult to write customized code for these kinds of tasks in K2, and the lack of documentation for large parts of the K2 functionality is something that I have found very frustrating. However, I don't think its correct to say that you "shouldn't really be using at all" in your applications, as the wizard will generate this code for most XML tasks. I'm sure someone from K2 can clarify this.

Badge +9
Tim is correct that K2Utilities is not considered a customer API, thus it is not publically documented.  I suspect the reasoning behind this is because it is very difficult to guarantee forward compatibility with all custom code implementations of it, if/when K2Utilities changes.
Badge +5

Tim,


You'll need to post the rest of the code before we can help you find an alternative.  At the end of the day, even though K2Utilities is not "supported", you shouldn't have a problem using it.  Most likely, your alternative is to use System.Xml.XmlDocument.


-mike

Badge +6

FYI: refer to KB 170 (http://kb.k2workflow.com/articles/kb000170.aspx) for a list of supported APIs.


Realize that part of the 'unsupported' condition is that the functionality of the unsupported API may change without notice if you upgrade K2 to another Service Pack. "Supported" APIs will work as before (or better ;-) after any K2 upgrades.

Badge +2
icon-quote.gifmike@k2:

Tim,


You'll need to post the rest of the code before we can help you find an alternative.  At the end of the day, even though K2Utilities is not "supported", you shouldn't have a problem using it.  Most likely, your alternative is to use System.Xml.XmlDocument.


-mike



That's a fair point Mike, when I look at it using XmlFieldHelper.get_XMLNode(xPath) is in effect the same as xmlDoc.SelectSingleNode(xPath, nsManager) - so in reality it shouldn't be too hard to replace this if we wanted to.


Many thanks


Tim

Badge +5

You got it,


Although it is used internally to K2Sutdio for quite a few things what your looking at here is basically a wrapper of XmlDocument with a series of helper methods.


-mike

Reply