on ‎2007 Feb 14 3:12 PM
Hi,
I have to add some xml fragments into a target XML. This target has some repetitive XML elements. The xml fragments to be added should go into each of this repetitive XML elements in the target XML.
For example, the
following XML has <book> element repeated twice.
<?xml version="1.0" encoding="UTF-8"?>
<bookstore><book>
<title lang="eng">Harry Potter</title>
<price>29.991</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.952</price>
</book>
</bookstore>
I want to add XML element <STATUS>104</STATUS> inside of each <book>
element. So, I assigned this <STATUS>104</STATUS> xml fragment for the following target XPath Local.test{/bookstore/book} using "Assign XML" radio button in Link Editor. After the assignment, it is expected that all the <book> elements will have the new element <STATUS>. But the target XML has the assignment
done only for the first <book> element.
Anybody know the worksaround for this issue?
Thanks,
Sara
Request clarification before answering.
Hi Sara,
Put that data of total bookstore in a repeater and repeat on book. Next in assignment block you need to write code Local.test{/bookstore/book[#repeater.currentItem#]}. Otherwise it will take default as book[0] and keep on adds to the first item only.
Thanks,
Rajesh
PS : Please award points if answer is useful.
Message was edited by:
Rajesh Madala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi sara,
We can use a repeater to do this.but,I would like to give u an another way which will save time of execution of transaction in case of huge data if u need to add a new column which is having to insert a same value or a value based on certain condition.U can use calculated columns action for doing this.In that u just need to give the query results set and column name which is to be added along with a value which u are going to give.u can set a value based on a condition there itself.
please revert in case of further assistance.
regards,
Ravi Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
I would personally try to avoid the "CalculatedColumns" action since we have found that for large rowsets (more than a few hundred rows), the action is significantly slower than using a repeater and the "xMII XML Output" action block such as "Add Row". This seems to be regardless of the complexity of the actual calculation which is performed.
Regards,
Sascha
Hello Sara,
Are you using a repeater block to enter your STATUS element to each of the book elements?
Best Regards,
Joe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.