# Generating an EDI output in XML format

**URL:** <https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014>\
**Category:** Forum\
**Tags:** EDI\
**Created:** [August 28, 2006, 8:16pm UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014 "2006-08-28T20:16:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![akalamkar](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@akalamkar](https://techcommunity.softwareag.com/u/akalamkar)\
**Post date:** [August 28, 2006, 8:16pm UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014/1 "2006-08-28T20:16:51Z")

</div>

I need to save the output of the IDOC to EDI mapping in XML format, as in the final output has to be an XML file containing tags such as BGM etc. Any idea how this can be done? Is there any way of creating a XML schema for an EDI document

---

<div class="post-metadata">

**Author:** ![reamon](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@reamon](https://techcommunity.softwareag.com/u/reamon)\
**Post date:** [August 28, 2006, 9:10pm UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014/2 "2006-08-28T21:10:27Z")

</div>

Have you tried pub.xml:documentToXMLString?

---

<div class="post-metadata">

**Author:** ![akalamkar](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@akalamkar](https://techcommunity.softwareag.com/u/akalamkar)\
**Post date:** [August 29, 2006, 12:34am UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014/3 "2006-08-29T00:34:02Z")

</div>

Thanks for the prompt reply and sorry as I made a mistake, since it is the first time I am posting to the wMusers community I did not ask the question with enough detail. Let me rephrase the question.  
The XML that I need to generate has the field descriptions in it and not the field names. i.e. instead of ´BEG´ I have ´BeginingOfSegment´. So my real problem arises when I try and count the number of segments. I need a method that is versatile enough to count the apropriate nodes in the XML.  
Also, I had to manually create the IS documents as I do not know of any other way in which such IS documents (containing the descriptions instead of the names) can be created.  
Now I have 2 questions, What is the best way to create the schema and what is the best way to count the number of segments in the XML?

---

<div class="post-metadata">

**Author:** ![reamon](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@reamon](https://techcommunity.softwareag.com/u/reamon)\
**Post date:** [August 29, 2006, 8:09pm UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014/4 "2006-08-29T20:09:20Z")

</div>

Creating the IS schema would need to be done by hand, if you need it. Another approach would be to create an XML schema using XMLSpy or other tool. Then use that to create an IS doc type and schema.

I’m tempted to ask why use description names instead of the segment names but I assume there’s some reason. BTW, BEG would be “BeginningSegment” not “BeginningOfSegment”.

As for counting segments that’s going to be a challenge. One approach that may work is to use the IS Java API to count the number of elements in your top level document. Other people may have other suggestions.

---

<div class="post-metadata">

**Author:** ![akalamkar](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@akalamkar](https://techcommunity.softwareag.com/u/akalamkar)\
**Post date:** [August 29, 2006, 8:48pm UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014/5 "2006-08-29T20:48:02Z")

</div>

Thanks for the suggestions. And the reason why I need the XML it in such a way is because the client wants it that way … there are reasons for that also but I won´t get into the details and yes that BEG example is not entirely correct. 🙂 but just needed to get the point across. Thanks again

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:05pm UTC](https://techcommunity.softwareag.com/t/generating-an-edi-output-in-xml-format/109014/6 "2021-04-02T15:05:29Z")

</div>


