Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All
I am searching for a fast solution for the problem of generating metadata from .item file. The problem is that this file has multiple loops so how we can parse this file
Best Regards
OK, this requires an extra step. The whole job looks like this....
Adding environments puts another loop into the equation. So you start off with the tFileInputXML configured as below.....
You then add a tExtractXMLField and configure as below....
Essentially you get the environment (env) and the sub-XML (context) from the first component. You then use the context column to extract further details (per environment) from the tExtractXMLField component. This loops on "/context/contextParameter", passes the "env" field through without any config, then extracts the "name" and "value".
If you try this, it will return what you need
What exactly are you looking for in the .items file? You might not have to search all of the loops. This is essentially an XML file and if you know what you are looking for, you should be able to go straight to it
Thank you for your interaction
I want to read the fields context and for each context I want to retrieve contexParameters next I want to save it in a text file. I tried tXMLMAP but it needs the schema of .item file
You can do this using the tFileInputXML or tExtractXMLField component. The image below demonstrates how to do this using the tFileInputXML component....
Thank you very much for this replay BUT I want also to retrieve the environment name which is located at <contaxt name=.....> along with the name and value of each contextpearameter
OK, this requires an extra step. The whole job looks like this....
Adding environments puts another loop into the equation. So you start off with the tFileInputXML configured as below.....
You then add a tExtractXMLField and configure as below....
Essentially you get the environment (env) and the sub-XML (context) from the first component. You then use the context column to extract further details (per environment) from the tExtractXMLField component. This loops on "/context/contextParameter", passes the "env" field through without any config, then extracts the "name" and "value".
If you try this, it will return what you need
Fantastic very nice this what I need. If you can give me more details about this solution or the logic behind it I will be very thankful
Best Regards
Essentially it is all to do with extracting data from looping XML. The items file I was working with is a bit big to include here, so I will just include the context variable section....
<context confirmationNeeded="false" name="Default">
<contextParameter comment="" name="rich" prompt="rich?" promptNeeded="false" type="id_String" value="cdvdc"/>
<contextParameter comment="" name="new1" prompt="new1?" promptNeeded="false" type="id_String" value="sdwf"/>
<contextParameter comment="" name="new2" prompt="new2?" promptNeeded="false" type="id_String" value="scsfs"/>
<contextParameter comment="" name="new3" prompt="new3?" promptNeeded="false" type="id_String" value="fwd"/>
</context>
<context confirmationNeeded="false" name="dev">
<contextParameter comment="" name="rich" prompt="rich?" promptNeeded="false" type="id_String" value="ghgh"/>
<contextParameter comment="" name="new1" prompt="new1?" promptNeeded="false" type="id_String" value="2323"/>
<contextParameter comment="" name="new2" prompt="new2?" promptNeeded="false" type="id_String" value="wdce"/>
<contextParameter comment="" name="new3" prompt="new3?" promptNeeded="false" type="id_String" value="2erfe"/>
</context>
<context confirmationNeeded="false" name="prod">
<contextParameter comment="" name="rich" prompt="rich?" promptNeeded="false" type="id_String" value="ssss"/>
<contextParameter comment="" name="new1" prompt="new1?" promptNeeded="false" type="id_String" value="fde"/>
<contextParameter comment="" name="new2" prompt="new2?" promptNeeded="false" type="id_String" value="wds"/>
<contextParameter comment="" name="new3" prompt="new3?" promptNeeded="false" type="id_String" value="wdewdf"/>
</context>
The code in red is the outer looping section. You will see there are 3 repeating blocks. This is where we get the environment AND the contextParameter sections which are directly related to the environment. The green sections are the loops within the environment loops. Remember that the environment is only listed on the loop outside this. Therefore, when the first component retrieves the environment, the environment and the block of nested XML inside that loop is sent to the tExtractXMLField component. This will loop for each of the contextParameter elements within the block of XML passed to it.