cancel
Showing results for 
Search instead for 
Did you mean: 

Data and Message Type for Multiple records after the XML declaration

Former Member
0 Kudos

Dear Experts ,

I have stucked in a part where I have to create a structure similar to below in SAP PI.The record <items> will be present as N number.


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

<items>

    <item>

        <Cat>test </Cat>

        <DocumentID>55DCE0A476D</DocumentID>

        <Sender>Rebecca</Sender>

        <UserName>user1</UserName>

        <Date>2013-02-14 11:14:40</Date>

        <Comment></Comment>

   </item>

</items>

  ......

  ......

  ......

<items>

    <item>

        <Cat>test </Cat>

        <DocumentID>55DCE0A476D</DocumentID>

        <Sender>Rebecca</Sender>

        <UserName>user1</UserName>

        <Date>2013-02-14 11:14:40</Date>

        <Comment></Comment>

   </item>

</items>

Regards...

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

AFAIK - an xml document can contain only one root element. So you can't have multiple items like this. It's not a valid xml.

You can have one more root element ad inside that you can place multiple items.

Former Member
0 Kudos

You can do like this :

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

<Root>

<items>

    <item>

        <Cat>test </Cat>

        <DocumentID>55DCE0A476D</DocumentID>

        <Sender>Rebecca</Sender>

        <UserName>user1</UserName>

        <Date>2013-02-14 11:14:40</Date>

        <Comment></Comment>

   </item>

</items>

  ......

  ......

  ......

<items>

    <item>

        <Cat>test </Cat>

        <DocumentID>55DCE0A476D</DocumentID>

        <Sender>Rebecca</Sender>

        <UserName>user1</UserName>

        <Date>2013-02-14 11:14:40</Date>

        <Comment></Comment>

   </item>

</items>

</Root>

Former Member
0 Kudos

Thanks Hareesh...

I am also under the same impression that under 1 root element we can have N records.

After going through the link http://www.utilities-online.info/xmltojson/#.VDu60GeSwaB it created lot of queries.

If you convert it , then the site shows a valid XML. Tried with the below sample.

{

    "items": [

        {

            "item": {

                "Subject": "test wared by wael",

                "DocumentID": "55DCE0A476D",

                "Sender": "Rebecca",

                "SenderDomainName": "user1",

                "Date": "2013-02-14 11:14:40",

                "DocumentClassID": "11",

                "Comment": "",

               

            }

        },

        {

            "item": {

                "Subject": "test wared by wael",

                "DocumentID": "55DCE191D5E47",

                "Sender": "Dave Froster",

                "SenderDomainName": "user11",

                "Date": "2013-03-14 11:14:40",

                "DocumentClassID": "11",

                "Comment": "",

              

            }

        }

    ]

}

Regards...

former_member184720
Active Contributor
0 Kudos

It just returns the xml but it's not validated.

If you validate the result xml then it should throw an error.

XML Validation: XML Validation

3:3The markup in the document following the root element must be well-formed

Answers (0)