Reputation: 85
I'm trying to achieve a scenario where I get the element for sure in the output even though it's not present in the input.
Eg: If my Input is
<?xml version="1.0" encoding="UTF-8"?>
<getMyClsScheduleResponse>
<RegisteredClass>
<ClassNumber>30788</ClassNumber>
</RegisteredClass>
<RegisteredClass>
<ClassNumber>30524</ClassNumber>
<Instructor>
<InstructorName>Bernstein,Dennis S</InstructorName>
<LastName>Bernstein</LastName>
<FirstName>Dennis</FirstName>
<Uniqname>DSBAERO</Uniqname>
<InstructorRole>Primary Instructor</InstructorRole>
</Instructor>
</RegisteredClass>
<RegisteredClass>
<ClassNumber>11786</ClassNumber>
<Instructor>
<InstructorName>Gluskich,Kari E</InstructorName>
<LastName>Gluskich</LastName>
<FirstName>Kari</FirstName>
<Uniqname>KARI</Uniqname>
<InstructorRole>Secondary Instructor</InstructorRole>
</Instructor>
<Instructor>
<InstructorName>Grocech,Marian Renee</InstructorName>
<LastName>Grocech</LastName>
<FirstName>Marian</FirstName>
<Uniqname>MARIANGR</Uniqname>
<InstructorRole>Primary Instructor</InstructorRole>
</Instructor>
</RegisteredClass>
</getMyClsScheduleResponse>
I'm expecting an output of
<?xml version="1.0" encoding="UTF-8"?>
<getMyClsScheduleResponse>
<RegisteredClasses>
<Title>30788</Title>
<Instructor/>
</RegisteredClasses>
<RegisteredClasses>
<Title>30524</Title>
<Instructor>
<Name>Bernstein,Dennis S</Name>
<Role>Primary Instructor</Role>
<Email>DSBAERO</Email>
</Instructor>
</RegisteredClasses>
<RegisteredClasses>
<Title>11786</Title>
<Instructor>
<Name>Gluskich,Kari E</Name>
<Role>Secondary Instructor</Role>
<Email>KARI</Email>
</Instructor>
<Instructor>
<Name>Grocech,Marian Renee</Name>
<Role>Primary Instructor</Role>
<Email>MARIANGR</Email>
</Instructor>
</RegisteredClasses>
</getMyClsScheduleResponse>
I'm trying to achieve this using altova mapforce . I have used the functions exists and non exists but it doesn't fetch me favorable results.
Please see the mapping
But the results are not as expected.
<?xml version="1.0" encoding="UTF-8"?>
<getMyClsScheduleResponse >
<RegisteredClasses>
<Title>30788</Title>
<Instructor/>
</RegisteredClasses>
<RegisteredClasses>
<Title>30524</Title>
<Instructor>
<Name>Bernstein,Dennis S</Name>
<Role>Primary Instructor</Role>
<Email>DSBAERO</Email>
</Instructor>
</RegisteredClasses>
<RegisteredClasses>
<Title>11786</Title>
<Instructor>
<Name>Gluskich,Kari E</Name>
<Name>Grocech,Marian Renee</Name>
<Role>Secondary Instructor</Role>
<Role>Primary Instructor</Role>
<Email>KARI</Email>
<Email>MARIANGR</Email>
</Instructor>
</RegisteredClasses>
</getMyClsScheduleResponse>
Can someone please help me out with the mapping?
Thanks Kranthi
Upvotes: 0
Views: 968
Reputation: 28
I had something similar happen. Until I find a better way, here's a User-Defined Function that I use in the meantime to force feed the output an empty node if the input value is empty. Connect the node output to your Instructor node and the code output to your value. You can replace the code output with a complex type if need be.
Upvotes: 0