Nuthan
Nuthan

Reputation: 1

XMLNSC attributes

I am getting the below message from an application

        field:CHARACTER:abcd
                mv:CHARACTER:1
                name:CHARACTER:NAME
                sv:CHARACTER:1
        field:CHARACTER:aaaaa
                mv:CHARACTER:1
                name:CHARACTER:Address
                sv:CHARACTER:1
        field:CHARACTER:123456
                mv:CHARACTER:1
                name:CHARACTER:Phone
                sv:CHARACTER:1

and i am parsing the above into XML and the code is:

SET OutputRoot.XML.EE_EAI_MESSAGE.Response.NAME     =   InputRoot.XMLNSC.Ns1:TNS.Ns1:Response.Ns1:Processed.Ns1:field[1];
SET OutputRoot.XML.EE_EAI_MESSAGE.Response.ADDRESS  =   InputRoot.XMLNSC.Ns1:TNS.Ns1:Response.Ns1:Processed.Ns1:field[2];
SET OutputRoot.XML.EE_EAI_MESSAGE.Response.MOBILE   =   InputRoot.XMLNSC.Ns1:TNS.Ns1:Response.Ns1:Processed.Ns1:field[3];

I have a problem as the application never includes an empty field in response message so the application is sending the message as

        field:CHARACTER:abcd
                mv:CHARACTER:1
                name:CHARACTER:NAME
                sv:CHARACTER:1
        field:CHARACTER:123456
                mv:CHARACTER:1
                name:CHARACTER:Phone
                sv:CHARACTER:1

the Address field is missing in the above input message. According to my esql code the data is incorrectly mapped due to field index. So i need to map the fields by checking the tagnames in input message, but i am not able to do... I am very thankful if anyone help on this.

Upvotes: 0

Views: 1461

Answers (1)

user4874078
user4874078

Reputation: 11

Try: SET OutputRoot.XML.EE_EAI_MESSAGE.Response.NAME = THE (SELECT T FROM InputRoot.XMLNSC.Ns1:TNS.Ns1:Response.Ns1:Processed.Ns1:field[] AS T WHERE T.name='NAME'); SET OutputRoot.XML.EE_EAI_MESSAGE.Response.ADDRESS = THE (SELECT T FROM InputRoot.XMLNSC.Ns1:TNS.Ns1:Response.Ns1:Processed.Ns1:field[] AS T WHERE T.name='Address'); SET OutputRoot.XML.EE_EAI_MESSAGE.Response.MOBILE = THE (SELECT T FROM InputRoot.XMLNSC.Ns1:TNS.Ns1:Response.Ns1:Processed.Ns1:field[] AS T WHERE T.name='Phone');

Upvotes: 1

Related Questions