LEGACY CONTENT
This article refers to legacy products, components or features. Therefore, the content in this article is offered "as is" and will no longer be updated. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

Introduction

Unexpected behavior may have been encountered at run time when retrieveing data from XML data fields under the following two (2) circumstances.

  • A node is located within a repeating group

    If the node is located within a repeating group, only the first item in the list will be selected. The remaining items in the repeating group are ignored.

  • An attribute with a namespace

    If the attribute has a namespace, then a null value was selected

Scenario

To illustrate the unexpected behaviour, consider the following scenario. A group of users is contained within an XML document and the K2 Object Browser is used to select the repeating group containing the user details. However, at run time only one user is listed; selected from the repeating fields.

To better understand why this has occured, the following section of the article will describe how K2 Server has interpreted the XML document and what the limitations were. The XML code sample below illustrates how this took place.

<MyData>
  <Users>
    <User name="User1" email="User1@MyData.com"/>
    <User name="User2" email="User2@MyData.com"/>
  </Users>
  <MoreUsers>
    <User email="User3@MyData.com">User3</User>
    <User email="User4@MyData.com">User4</User>
  </MoreUsers>
  <EvenMoreUsers>
  <User>
    <Name>User5</Name>
    <Email>User5@MyData.com</Email>
  </User>
  <User>
    <Name>User6</Name>
    <Email>User6@MyData.com</Email>
  </User>
  </EvenMoreUsers>
</MyData>
Note: If an attribute had a namespace, then a null value would have been selected in all of the examples cited below.

Node: Users

  • If you select the *Name* attribute, User1 and User2 will be the destination users.
  • If you select the *User* node, blank users will be added because the inner text contains nothing.
Node: MoreUsers
  • If you select the *User* node, User3 and User4 will be the destination users because the inner text property contains those values.
  • If you select the *Email* attribute, the values User3@MyData.com and User4@MyData.com will be used.
Node: EvenMoreUsers
  • If you select the *User* node, the inner text will be selected and “flattened” out resulting in the values “User5@MyData.com” and “User6@MyData.com” – this is obviously not correct.
  • If you select the *Name* node underneath User node, only User5 will be the destination user.

Workaround

Using a node that is nested within a repeating group will not result in a resolved list of users. Rather, this results in only the first user being selected or read from the repeating group and the remaining data is not identified as a list. The code sample below illustrates how the XML should be structured to form a user list in such a way that the K2 Server will be able to resolve the users.
Note: In the examples cited below, InfoPath may require the attribute to be included. Use option 1 as the preferred alternative.
//Option 1: The repeating group is not inside a repeating group

<Users>
  <User>User1</User>
  <User>User2</User>
</Users>

//Option 2: The attribute does not have a namespace

<Users>
  <my:User>User1</my:User>
  <my:User>User2</my:User>
</Users>

Error Resolution

This Hotfix is contained within the latest K2 blackpearl 0807 Update. Install the update package to resolve the error.

The latest K2 blackpearl 0807 Update is available as an independent installation package which can be found here: https://portal.k2.com/downloads/bp/default.aspx.