Expand my Community achievements bar.

SOLVED

Updating Process Variable (XML) using Set Value

Avatar

Level 4

Hi,

I am having a problem in updating the value in XML variable using SetValue (by XPATH expression). It is deleting my original XML and replacing it by new one. I am out of clue why it is happening so.

My Steps:
1. I have created a variable as XML type and Set it as INPUT, REQUIRED.

xmlData.jpg

2. I am updating this variable using Set Value activity. In my process it is 'locUpdate1'

setVal.jpg

The original XML is: (value of xmlData)

<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" xmlns:dd="http://ns.adobe.com/data-description/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" timeStamp="2011-01-03T07:31:26Z" uuid="009257fd-3f66-449d-b554-6a095f917b74">
<xfa:datasets>
        <xfa:data>
            <GetUserRoot>
                <applicantInformation>
                    <UserInfo>
                        <UserID1/>
                        <UserName1/>
                        <UserID2/>
                        <UserName2/>
                        <UserID3/>
                        <UserName3/>
                        <CurrentUserID>6967A5DE-D5EB-102D-BF7F-0000C0A8010C</CurrentUserID>
                        <CurrentUserName>Sarah Rose</CurrentUserName>
                    </UserInfo>
                </applicantInformation>
                <FSTARGETURL_/>
            </GetUserRoot>
        </xfa:data>
        <dd:dataDescription dd:name="GetUserRoot">
            <GetUserRoot>
                <applicantInformation>
                    <UserInfo>
                        <UserID1/>
                        <UserName1/>
                        <UserID2/>
                        <UserName2/>
                        <UserID3/>
                        <UserName3/>
                        <CurrentUserName/>
                        <CurrentUserID/>
                    </UserInfo>
                </applicantInformation>
            </GetUserRoot>
        </dd:dataDescription>
    </xfa:datasets>
<pdf xmlns="http://ns.adobe.com/xdp/pdf/" href="-4608764380271080676-28"/>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
        <annots/>
    </xfdf>
</xdp:xdp>

After Operating it is changing to

<GetUserRoot>
    <applicantInformation>
        <UserInfo/>
    </applicantInformation>
</GetUserRoot>

which should not be done.

I just want to copy one element's value into another.

/process_data/xmlData/GetUserRoot/applicantInformation/UserInfo/UserID1 = /process_data/xmlData/GetUserRoot/applicantInformation/UserInfo/CurrentUserID

Result Should be:

<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" xmlns:dd="http://ns.adobe.com/data-description/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" timeStamp="2011-01-03T07:31:26Z" uuid="009257fd-3f66-449d-b554-6a095f917b74">
<xfa:datasets>
        <xfa:data>
            <GetUserRoot>
                <applicantInformation>
                    <UserInfo>
                        <UserID1>6967A5DE-D5EB-102D-BF7F-0000C0A8010C</UserID1>
                        <UserName1>Sarah Rose</UserName1>
                        <UserID2/>
                        <UserName2/>    
                        <UserID3/>
                        <UserName3/>
                        <!-- this is to be coiped in above -->
                        <CurrentUserID>6967A5DE-D5EB-102D-BF7F-0000C0A8010C</CurrentUserID>
                        <CurrentUserName>Sarah Rose</CurrentUserName>
                    </UserInfo>
                </applicantInformation>
                <FSTARGETURL_/>
            </GetUserRoot>
        </xfa:data>
        <dd:dataDescription dd:name="GetUserRoot">
            <GetUserRoot>
                <applicantInformation>
                    <UserInfo>
                        <UserID1/>
                        <UserName1/>
                        <UserID2/>
                        <UserName2/>
                        <UserID3/>
                        <UserName3/>
                        <CurrentUserName/>
                        <CurrentUserID/>
                    </UserInfo>
                </applicantInformation>
            </GetUserRoot>
        </dd:dataDescription>
    </xfa:datasets>
<pdf xmlns="http://ns.adobe.com/xdp/pdf/" href="-4608764380271080676-28"/>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
        <annots/>
    </xfdf>
</xdp:xdp>

Any help what I am doing wrong.

Thanks.

-

Abhinav

1 Accepted Solution

Avatar

Correct answer by
Level 10

Your assignment is incorrect. Note that you must refer all the nodes of XML (right from the ROOT node)

Since your node reference is not absolute,it will create nodes as you defined in your left-side expression.

The following code should work as you expected!

/process_data/xmlData/xdp/datasets/data/GetUserRoot/applicantInformation/UserInfo/UserID1 = /process_data/xmlData/xdp/datasets/data/GetUserRoot/applicantInformation/UserInfo/CurrentUserID

Nith

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Your assignment is incorrect. Note that you must refer all the nodes of XML (right from the ROOT node)

Since your node reference is not absolute,it will create nodes as you defined in your left-side expression.

The following code should work as you expected!

/process_data/xmlData/xdp/datasets/data/GetUserRoot/applicantInformation/UserInfo/UserID1 = /process_data/xmlData/xdp/datasets/data/GetUserRoot/applicantInformation/UserInfo/CurrentUserID

Nith