on 10-13-2014 1:26 PM
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...
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
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...
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: | 3 | The markup in the document following the root element must be well-formed |
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.