cancel
Showing results for 
Search instead for 
Did you mean: 

XML Tags

former_member188791
Participant
0 Kudos

Hi Group,

In PI we are generating the below Output XML file,but our vendor is expecting in differen XML format,can any body suggest how we can conver this in PI:

PI Output

------------------------------

  <?xml version="1.0" encoding="UTF-8" ?> 

<RACTS>

<RACT>

  <ACTID>123456789</ACTID>

<NAPM>

  <MPANID>7712342</MPANID>

<ATERS>

<ATER>

  <RLG>0.15</RLG>

  <RUR>0.15</RUR>

  <RLI>0.15</RLI>

  <ARM>0.15</ARM>

</ATER>

</ATERS>

  </NAPM>

<\RACT>

<\RACTS>

Expecting output

-----------------------------

<?xml version="1.0" ?>

<RACTS>

<RACT>

  <ACTID="123456789"</ACTID>

<NAPM>

  <MPANID="7712342"</MPANID>

<ATERS>

  <ATER name="RLG">0.15,</ATER>

  <ATER name="RUR">0.15</ATER>

  <ATER name="RLI">0.15</ATER>

  <ATER name="ARM">0.15</ATER>

</ATERS>

  </NAPM>

<\RACT>

<\RACTS>

AlsoIN PI output we are getting we are getting two exta spaces in the first row before "<?xml version="1.0" encoding="UTF-8" ?>  ", how to delete that two extra spaces.Pleas can any body help

Accepted Solutions (0)

Answers (3)

Answers (3)

iaki_vila
Active Contributor
0 Kudos

Hi Rajiv,

I think the biggest problem is that you must convert elements in attributtes:

<RLG>0.15</RLG> ----> <ATER name="RLG">0.15,</ATER>

If the attributes will be always the same, it's possible to do with an XSL, but if the attributtes could change it will be difficult with xsl. Are the tags that are going to be "attributed" determinated, like always  <RLG>, <RUR>, etc and no more?

Finally i think these tag are incorrect, What will be the correct?:

  <ACTID="123456789"</ACTID>

<MPANID="7712342"</MPANID>

Regards

former_member188791
Participant
0 Kudos

Hi Inaki,

These are correct only,but I am not sure how achive this

  <ACTID="123456789"</ACTID>

<MPANID="7712342"</MPANID>

former_member184681
Active Contributor
0 Kudos

I think it should rather be:

<ACTID attribute_name="123456789"/>

<MPANID attribute_name="7712342"/>

Or even like that:

<RACTS>

     <RACT ACTID="123456789">

          <NAPM MPANID="7712342">

               <ATERS>

                    <ATER name="RLG">0.15,</ATER>

                    <ATER name="RUR">0.15</ATER>

                    <ATER name="RLI">0.15</ATER>

                    <ATER name="ARM">0.15</ATER>

               </ATERS>

          </NAPM>

     </RACT>

</RACTS>

You can achieve this exactly the same way: define the attribute in Data Type, then map the value normally as for a field/node.

Regards,

Greg

former_member184681
Active Contributor
0 Kudos

Hi,

To change the XML structure:

1. In Data Type definition, place the cursor on the ATER field and click the "Add" button and choose Insert Attribute, type "name" as the name.

2. In Message Mapping, use Duplicate Subtree to create four copies of the ATER node, map the constants to the name attribute and the corresponding value to the ATER node itself.

About those spaces, there are a few possibilities. If you are using any other mapping than the graphical one, you might be adding it accidentally. It might also be only a matter of how PI displays it in moni - you can try checking the actual file content.

Regards,

Greg

former_member188791
Participant
0 Kudos

Hi Greg,

Thank you for your reply.

I am using graphical mapping ,I will try ur  points 1 and 2, I am still not sure why PI generating those two spaces,also is there any way we can get rid of "UTF8" encoding" in the header.

former_member184681
Active Contributor
0 Kudos

>>> is there any way we can get rid of "UTF8" encoding" in the header

As far as I know, the only way to do this is a Java mapping, executed after the main (graphical) mapping.

Regards,

Greg

rajasekhar_reddy14
Active Contributor
0 Kudos

Which mapping technique are you using? if you are using XSLT then you can edit your mapping accordingly

refer below link(dall replies and implement AMith logic..to remove spaces).

http://scn.sap.com/message/13267338