Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Adding a node through XPath

Avatar

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
yodadobe
Level 5

02-03-2009

I need to add an item into my XML.


user1


to


user1
user2


I thought I read where I could just set a value to the new index: Approvers/Approver[2]/ApproverID="user2"

That is not working though.

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

03-03-2009

Nope the Approver[2] node must exist for that to happen. You can replace nodes that exist so if you changed the Approvers node with the new XML then you would get your desired result.

Avatar

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
yodadobe
Level 5

03-03-2009

I need the old data plus the new so I end up with the same problem creating the new XML. My work around is to do it with Strings then replace, but it is messy.

Avatar

Avatar
Level 6
neptas
Level 6

Likes

0 likes

Total Posts

259 posts

Correct Reply

0 solutions
View profile

Avatar
Level 6
neptas
Level 6

Likes

0 likes

Total Posts

259 posts

Correct Reply

0 solutions
View profile
neptas
Level 6

04-03-2009

Hi,

I need something similar: I have a document var with a xml document. I need to take part of that xml (a specific nodeset) and add it to a string.



any ideas to acomplish this?



thank you

Avatar

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile
Jasmin_Charbonn
Level 10

04-03-2009

First you want to put the content of the document into a XML var so you can use xPath.



You can use xPath to get to the node you want (ex. /process_data/myXMLVar/Root/Customers).



Then use the serialize function from the xPath editor (under Misc) to convert the nodes into a string:



serialize(/process_data/myXMLVar/Root/Customers)



Finally you can use the concat function from the xPath editor (under string) to merge two strings together:



concat(/process_data/@myStringVar, serialize(/process_data/myXMLVar/Root/Customers))



Jasmin

Avatar

Avatar
Validate 1
Level 3
The_Flex_Viking
Level 3

Likes

2 likes

Total Posts

121 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 3
The_Flex_Viking
Level 3

Likes

2 likes

Total Posts

121 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
The_Flex_Viking
Level 3

05-03-2009

Write an ExecuteScript activity?

Avatar

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile
Jasmin_Charbonn
Level 10

05-03-2009

I don't understand your question.



Jasmin

Avatar

Avatar
Validate 1
Level 9
Steve_L_Walker
Level 9

Likes

197 likes

Total Posts

1,435 posts

Correct Reply

212 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 9
Steve_L_Walker
Level 9

Likes

197 likes

Total Posts

1,435 posts

Correct Reply

212 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
Steve_L_Walker
Level 9

07-03-2009

A node can be added to an XML instance using XSL in an XSLT Transform service, also.

My sample process uses two input process variables:

1. 'inputXml' of type xml


user1


2. 'approverId' of type string

foobar

I define the following XSLT template which consumes the input process variable 'approverId':



ApproverID
{$ /process_data/@approverId $}









The result of the applying the XSL is as follows:



user1


foobar



The process could be designed to iterate over the input XML and the XSL.

Steve