I have a requirement where an XML of the below format need to be generated.
<demands>
<demand>
<brand>ABC</brand>
<submittedby>KZK4164</submittedby>
<senddate>2013-08-14 09:42:44.353000</senddate>
<tasklistname>CONFIG_SEND</tasklistname>
<srcfilename>CONFIG-13859</srcfilename>
<uid>13859</uid>
<stores>
<store>008256</store>
<store>008563</store>
</stores>
</demand>
<demand>
<brand>ABC</brand>
<submittedby>KZK4164</submittedby>
<senddate>2013-08-14 09:42:44.353000</senddate>
<tasklistname>CONFIG_CANCEL</tasklistname>
<uid>13859</uid>
<stores>
<store>008233</store>
<store>008444</store>
<store>008454</store>
<store>008463</store>
</stores>
</demands>
I used the STORE number as a key in the XML input and have generated each repeating demand item by applying Trigger to the UID element. The only problem I am facing now is with the start and end tag <demands></demands> . If I am specifying the XPath like /demands/demand/(the corresponding element) then I get the <demands></demands> combination getting repeated for each demand item. I only need this <demands></demands> only once in my file.
To achieve this I passed the input through another XML output stage but I got a truncated output with only a very few records.
xml tags not generating
Moderators: chulett, rschirm, roy
Hard to say. I've seen things like this before when the higher level repeating node is not easily unique (meaning --- you have to go to its 3rd or 4th element before noticing that the next instance of demand is indeed unique from the prior one). ...in this case you have to go to tasklistname before we know it's not the same demand.
In those cases, if that's what is causing this, I find it beneficial to add a counter to each of my separate higher level nodes. ....so....upstream, create a "demand" counter that is unique for every unique group of demand rows. Then put that counter as the first element in your demand node, such as:
myCounter .....................................with description of /.../demands/demand/myCounter/text()
See if that creates the correct structure. If so, edit out the myCounter element (if you need to --- depends on what type of app is receiving the xml) in a downstream transformer using ereplace or similar.
Ernie
In those cases, if that's what is causing this, I find it beneficial to add a counter to each of my separate higher level nodes. ....so....upstream, create a "demand" counter that is unique for every unique group of demand rows. Then put that counter as the first element in your demand node, such as:
myCounter .....................................with description of /.../demands/demand/myCounter/text()
See if that creates the correct structure. If so, edit out the myCounter element (if you need to --- depends on what type of app is receiving the xml) in a downstream transformer using ereplace or similar.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
From what I see in your sample XML, it seems you're not just creating this XML in one step. If you are creating your repeating XML tags in a separate step and appending that XML chunk in some columns like <store>. If so, don't define XPath for those tags, just put a '/' and specify it as XML in data element. I guess that should fix your problem.
Arun
We already tried the exact same way. But the repetition chunk is not displaying properlyarunkumarmm wrote:From what I see in your sample XML, it seems you're not just creating this XML in one step. If you are creating your repeating XML tags in a separate step and appending that XML chunk in some columns like <store>. If so, don't define XPath for those tags, just put a '/' and specify it as XML in data element. I guess that should fix your problem.
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
So this is your problem. You create the chunk with full XPath twice so its obvious that you get your root element for every record. And the exact same way should work. From my best knowledge, that is the only way to do it. Just to make sure, you just defined the XPath with '/' or did you even mention that it is an XML in the 'Data Elements'?
Arun
Looking at this more closely, another issue might be the use of trigger --- are you expecting to create multiple documents? Generally speaking you will want to use the "Aggregate" option, and then specify the lowest level repeating unit (just pick one of the elements at that level) as a key.
You may still also be having issues with the uniqueness of the parent, as I outlined earlier.
Ernie
You may still also be having issues with the uniqueness of the parent, as I outlined earlier.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>