Page 1 of 1

XML InputStage - Getting all Element Values from XML File

Posted: Wed Jan 30, 2008 3:18 pm
by turash
I have to extract values from all MappingElement ElementId in following XML File.

Code: Select all

<Response>
	<Header/>
	<XmlTransaction>
		<TransName>MAP</TransName>
		<Completiontext>Successful</Completiontext>
		<CompletionCode>1</CompletionCode>
		<ReferenceMapping>
			<AppSource>XX</AppSource>
			<TargetSystemId>YY</TargetSystemId>
			<EffectiveDt>2008-01-30</EffectiveDt>
			<Attributes/>
			<Codes>
					<MappingElement ElementId="P1">
					<SourceGroup>
						<Off>777</Off>
						<PSS>03456</PSS>
					</SourceGroup>
					<TargetGroup>
						<HF>55403456</HF>
					</TargetGroup>
				</MappingElement>	
				<MappingElement ElementId="P2">
					<SourceGroup>
						<Country>US</Country>
					</SourceGroup>
					<TargetGroup>
						<Country>001</Country>
					</TargetGroup>
				</MappingElement>	
			</Codes>
		</ReferenceMapping>	
	</XmlTransaction>
</Response>

Xpath
Image

I am not able to extract Second element
MappingElement ElementId="P2"

Thanks in advance!!

Posted: Wed Jan 30, 2008 4:57 pm
by eostic
Did you get anything at all? This should yeild an error because there is no key selected for your repetitition element. Tell us what happens when, for example, you make Country under target group your repetition element, and then be sure that "repetition element required" is unchecked in the properties....

You should get two rows.

Ernie

Posted: Wed Jan 30, 2008 7:04 pm
by turash
eostic wrote:Did you get anything at all? This should yeild an error because there is no key selected for your repetitition element. Tell us what happens when, for example, you make Country under target group your repetition element, and then be sure that "repetition element required" is unchecked in the properties....

You should get two rows.

Ernie
Part of the problem is when I try to import xml structure Country under target group does not appear for selection.

If i make element id as key and repetition element
I get two rows but not able to extract country values in source and target group

Posted: Wed Jan 30, 2008 10:39 pm
by eostic
Since you are already asking for the details from each of the two groups, just add the columns you want by hand:

SourceCountry ...... /...../...../..... etc...../SourceGroup/Country/text()


and

TargetCountry..... /..../..../....etc ..../TargetGroup/Country/text()

It "looks" like these are singly occurring, so make either country your repeating element and you should be fine, but be certain to uncheck "repeating element required" or else you will lose Mappings if the Country element is not present.

Ernie

Posted: Thu Jan 31, 2008 9:28 am
by turash
Thanks a lot Ernie
eostic wrote:Since you are already asking for the details from each of the two groups, just add the columns you want by hand:

SourceCountry ...... /...../...../..... etc...../SourceGroup/Country/text()


and

TargetCountry..... /..../..../....etc ..../TargetGroup/Country/text()

It "looks" like these are singly occurring, so make either country your repeating element and you should be fine, but be certain to uncheck "repeating element required" or else you will lose Mappings if the Country element is not present.

Ernie