<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to generate a xml document?</title><link>https://community.appian.com/discussions/f/general/13047/how-to-generate-a-xml-document</link><description>I have values which are stored in pv and which are basically xml strings. Now to want to create a xml file and write those data to the file and save it to appian. How can I achieve it?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to generate a xml document?</title><link>https://community.appian.com/thread/58771?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 11:03:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:48208f3e-17ed-4df6-8ed6-3b9ed523a230</guid><dc:creator>josep</dc:creator><description>Hello sudiptav&lt;br /&gt;
&lt;br /&gt;
How complex is your XML? The CDT itself is an XSD so I think you can still use it in a complex scenario. Can you describe how complex is your XML?  To fill this cdt with data you can have multiple for each in a rule transforming the “table cdt” to the “xml cdt”&lt;br /&gt;
&lt;br /&gt;
To create a complex CDT you can follow the Antipattern used of the CDTs used in the ones that write to the database. Specifically to give an example you can have nested a lot of levels.&lt;br /&gt;
&lt;br /&gt;
database CDT (we prefer flat version, as possible, at least they a view)&lt;br /&gt;
&amp;lt;person&amp;gt;&lt;br /&gt;
  &amp;lt;name&amp;gt;&lt;br /&gt;
 &amp;lt;lastName&amp;gt;&lt;br /&gt;
  &amp;lt;birthdate&amp;gt;&lt;br /&gt;
  &amp;lt;addressStreet&amp;gt;&lt;br /&gt;
  &amp;lt;addressZupCode&amp;gt;&lt;br /&gt;
  &amp;lt;address...&amp;gt;&lt;br /&gt;
  &amp;lt;phone1type&amp;gt;&lt;br /&gt;
  &amp;lt;phone1countryCode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XML CDT(here you can add multiple layers and maybe even reuse the original cdt&lt;br /&gt;
&amp;lt;root&amp;gt;&lt;br /&gt;
 &amp;lt;persons&amp;gt;&lt;br /&gt;
  &amp;lt;person&amp;gt;&lt;br /&gt;
   &amp;lt;personId&amp;gt;&lt;br /&gt;
    &amp;lt;status&amp;gt;&lt;br /&gt;
     &amp;lt;statusId&amp;gt;&lt;br /&gt;
     &amp;lt;birthdate &amp;gt; &lt;br /&gt;
     &amp;lt;birthdateFormated &amp;gt; &lt;br /&gt;
    &amp;lt;name&amp;gt;...&lt;br /&gt;
     &amp;lt;lastName&amp;gt;...&lt;br /&gt;
      &amp;lt;address&amp;gt;&lt;br /&gt;
        &amp;lt;street&amp;gt;..&lt;br /&gt;
        &amp;lt;zipCode&amp;gt;&lt;br /&gt;
      &amp;lt;/address&amp;gt;&lt;br /&gt;
       &amp;lt;phones&amp;gt;&lt;br /&gt;
         &amp;lt;phone&amp;gt;&lt;br /&gt;
          &amp;lt;phoneType&amp;gt;&lt;br /&gt;
          &amp;lt;number&amp;gt;&lt;br /&gt;
           &amp;lt;countryCode&amp;gt;&lt;br /&gt;
            ....&lt;br /&gt;
           &lt;br /&gt;
notes:&lt;br /&gt;
* when I have to make this I prefer to create almost a new version of the cdt to include the labels, IDs and the formatted version of the information. &lt;br /&gt;
* When calling the toxml function you define the namespace or you can define one empty.&lt;br /&gt;
&lt;br /&gt;
Even if you have any other special requirement you can still “modify a little the xml as text”.&lt;br /&gt;
&lt;br /&gt;
So my question is, what is the actual structure you want to achieve ? How complex is it? &lt;br /&gt;
&lt;br /&gt;
To give you a concrete example of this situation when you import a WSDL the xml structure can be really complex and we still able to call it. &lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
Jose&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate a xml document?</title><link>https://community.appian.com/thread/58770?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 09:58:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aaa4304c-e991-474b-940c-aa09fb9774d6</guid><dc:creator>Sudipta Biswas</dc:creator><description>I have a complex xml. Can you refer a custom plug in to achieve this?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate a xml document?</title><link>https://community.appian.com/thread/58765?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 07:17:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2c134661-fa8a-4455-92b0-33387a2cf0a0</guid><dc:creator>Shanmukha</dc:creator><description>&lt;p&gt;Hi Sudip,&lt;br /&gt; You can achieve this in following ways. &lt;br /&gt; &lt;br /&gt; 1) Create a custom CDT with all the necessary properties so it can create xml based on that CDT use toXML(). I think you might have heard of this.&lt;br /&gt; &lt;br /&gt; 2) If you want to create complex xml then you can use the custom plugin to achieve this. &lt;br /&gt; &lt;br /&gt; I think the first one gives you the best results compare to the second one until you need to create simple XML. I hope this will help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>