Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Mapping unmatched request and response depending on document order

Hi all,

I need help with a task where i need to map requests an responses within one xml-file, where those are not correlated except for the ordering within the document.

What shall be the result is a csv-file, containing the request and all the elements of each response in a sequence

 

here is schematic what the xml looks like:

 

<SomeXML>
	<Request>
		<attribute1>ABC</attribute1>
		<attribute2>DEF</attribute2>
	</Request>
	<Response>
		<Solution>
			<Segment>
				<attribute10>LMN</attribute10>
				<attribute11>OPQ</attribute11>
			</Segment>
			<Segment>
				<attribute10>123</attribute10>
				<attribute11>456</attribute11>
			</Segment>
		</Solution>
		<Solution>
				<attribute10>xxx</attribute10>
				<attribute11>yyy</attribute11>
		</Solution>
	</Response>
</SomeXML>

So each request does have one response, but not referencing the request.

 

Within each respoonse there can be several solutions containing one or more segments.

My idea so far is to "enhance" the xml into something like this:

 

<SomeXML>
	<Request id="req1">
		<attribute1>ABC</attribute1>
		<attribute2>DEF</attribute2>
	</Request>
	<Response reqid="req1">
		<Solution id="sol1">
			<Segment sortorder="0">
				<attribute10>LMN</attribute10>
				<attribute11>OPQ</attribute11>
			</Segment>
			<Segment sortorder="1">
				<attribute10>123</attribute10>
				<attribute11>456</attribute11>
			</Segment>
		</Solution>
		<Solution id="sol2">
			<Segment sortorder="0">		
				<attribute10>xxx</attribute10>
				<attribute11>yyy</attribute11>
			</Segment>
		</Solution>
	</Response>
</SomeXML>

In particular adding an id-attribute for each request and storing this same id-attribute wihtin the corresponding response as they are unmatched.

Plus also adding an id-attribute for each solution and a sortorder to each segment.

I am able to convert this structure into the desired csv-format. But I have no clue how to do the "enhancement" of the xml.

Unfortunately it is impossible to get such an "enhanced" xml from the sender of the xml-file.

 

Does anyone have a hint (or maybe even a solution) how to solve this "enhancement"?

 

Thanks in advance,

Stephan

 

Labels (3)
0 Replies