cancel
Showing results for 
Search instead for 
Did you mean: 

Read XML By PI

former_member474499
Participant
0 Kudos

Hello,

I want to know if PI can read an XML file and do the mappings as for the files.

If yes, can you please tell me how?

I'm really in need for your answers.

thank you in advance.

Best regards,

Hk

Accepted Solutions (1)

Accepted Solutions (1)

former_member474499
Participant
0 Kudos

Hello,

Thank you all for your answers.

I'm used to put csv file as input of PI, define the input and output structures in Enterprise Services Repository and define my mappings.

But with XML file, i don't see really houw would my input structure be for a file like this one :

<?xml version="1.0" encoding="iso-8859-1" ?>

<CUSTOMERS>

  <PERSON>

    <customer_id>1</customer_id>

    <first_name>Jan</first_name>

    <last_name>Krohn</last_name>

    <tel>

        <tel1>066666666</tel1>

        <tel2>066666666</tel2>

    </tel>

  </PERSON>

</CUSTOMERS>

Can you please explain how to do that?

Thank you so much.

Kind regards

Former Member
0 Kudos

Hi,

We dont create structure based on xml .we create based on mapping sheet which holds the structure.

Your structure might be like below.

CUSTOMERS    node

  PERSON           node

    customer_id    field of type string/int

    first_name      field of type string

    last_name      field of type string

    tel                    node

        tel1              field of type string/int

       tel2               field of type string/int

Regards

Venkat

iaki_vila
Active Contributor
0 Kudos

Hi Hk,

If i understand rigth your requeriment, the xml that you pointed is the file that you will receive. If you want to know what xsd structure is, you have some websites that do this work for you, for example:

http://www.freeformatter.com/xsd-generator.html

With your XML you can obtain the next xsd:

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
<xs:element name="CUSTOMERS">
   
<xs:complexType>
     
<xs:sequence>
       
<xs:element name="PERSON">
         
<xs:complexType>
           
<xs:sequence>
             
<xs:element type="xs:byte" name="customer_id"/>
             
<xs:element type="xs:string" name="first_name"/>
             
<xs:element type="xs:string" name="last_name"/>
             
<xs:element name="tel">
               
<xs:complexType>
                 
<xs:sequence>
                   
<xs:element type="xs:int" name="tel1"/>
                   
<xs:element type="xs:int" name="tel2"/>
                 
</xs:sequence>
               
</xs:complexType>
             
</xs:element>
           
</xs:sequence>
         
</xs:complexType>
       
</xs:element>
     
</xs:sequence>
   
</xs:complexType>
 
</xs:element>
</xs:schema>

Regards.

Answers (5)

Answers (5)

former_member474499
Participant
0 Kudos

Hello,

Thank you all for your answers.

It worked as you described.

Best regards

Former Member
0 Kudos

Hi Krishna,

Yes .PI could able to read XML or CSV or fixed length file using its FILE adapter .

In FILE adapter we configure the details of server in file has been placed.

PI polls the server for matching file name that has been configured in adapter .If it founds then it will apply the lock on it till it pick the file .

If you have a file to pick up with the xml structure, you should use the file/ftp adapter. As your files are yet in XML youd don´t need the file content converversion, it's much easier:

Check this:http://help.sap.com/saphelp_nw73/helpdata/en/44/682BCD7F2A6D12E10000000A1553F6/frameset.htm

Thanks & Regards,

Seshu.

Former Member
0 Kudos

Hi Chinna,

It is not good to copying the above suggestions and pasting as your suggestion .Please read forum rules and regulations first.

Regards

Venkat

iaki_vila
Active Contributor
0 Kudos

Hi,

If you have a file to pick up with the xml structure, you should use the file/ftp adapter. As your files are yet in XML youd don´t need the file content converversion, it's much easier:

Check this: http://help.sap.com/saphelp_nw73/helpdata/en/44/682BCD7F2A6D12E10000000A1553F6/frameset.htm

2. To send the file content to the Integration Engine or the PCK unchanged, select File under Message Protocol.

In the remainder development you will need the sender schema/wsdl/dtd for construct the data types/message types or external definitions and you can construct the mappings withount any problem.

Also, if you need a file in the receiver side with xml structure, it will be an eaiser that the sender side.

If you have a specific problem, explain in detail it to the community.

Regards,

Former Member
0 Kudos

Hi Krishna,

Yes .PI could able to read XML or CSV or fixed length file using its FILE adapter .

In FILE adapter we configure the details of server in file has been placed.

PI polls the server for matching file name that has been configured in adapter .If it founds then it will apply the lock on it till it pick the file .

Regards

Venkat

Former Member
0 Kudos

HI Kima,

PI mainly understand xml files only.  If your using .txt or .csv PI File adapter will convert that files to xml language using file content conversion.

Please explain what is your exact requirement.

Thanks,

Satish.

Former Member
0 Kudos

Hi HK,

Defiantly PI can read the XML file and mapping also .

What is exact question and what is your requirements ...?

thanks and regards,

Anup Banerjee