[XML] RecordList to XML

[XML] RecordList to XML


I m going to Use XmlRecords1.5.8, to do Integration in which i have to sent my application data wrapped into XML file.
I have that XML sample file i just want to assign My values to particular root node/attribute.
<CONTACT_POINT _Type="Phone" _Value="{#phone}"/>
In this example i have to replace my value between {7023690905}

also i attached that xml file
Can anybody please tell me step by step procedure ASAP to do this.

Hi Vipul,

Unfortunately from your description I could not exactly understand what you are trying to do.

Do you want to generate an XML file with a specific format?
Or do you just want to replace some values in an existing XML format?

Please explain a bit better the use case you want to implement for our analysis.

Kind Regards,

Daniel Lourenço
Hi Daniel Lourenço,
Thank you for response really appreciated.
I have an XML file with a specific format and i just want to replace some values in that XML format.

Vipul Takalkar

Please find the attachment XML File. In this file i have to replace my value in between {}
<TRANSMITTAL_DATA PropertyAppraisedValueAmount="{!appraised_value}"/>
I have to replace with "120000"
<TRANSMITTAL_DATA PropertyAppraisedValueAmount="120000"/>
Rest all values keep as it is.

Please suggest me the way how to perform this task asap.

Thanks and regrads,
Vipul Takalkar

Sincerelly the "correct" way for doing that would be to have the structures with all the attributes filled (even the ones you don't actually need to change) and just call the RecordList to xml. If the configurations and structures are all done correctly it could generate the correct xml that you need.
(and looking at the oml that Chandrasekar posted on the thread where he is trying to read a xml where the structures really look like yours, most of the job is probably already done)

Another alternative (low tech solution ..but a lot lower on performance) would be to actually just do the replaces like you are talking using the "Replace" builtin function to replace each of the placeholders, one by one. The only bit harder part is on the items that appear repeated (for example on the _ALIAS).
hello João Rosado
Thank you very much for the detailed explanation.I will try by this way.
If i get any query, I'll let you know.

Vipul Takalkar

Is there a tutorial of some kind on how to use this?

Kind regards
Hello João Rosado,

I'm struct in the problem. I have to save XML file as a TEXT in Static Entity. But while doing the it won't save because there are many double quotes ("") in XML, i think it breaks the string format.
Can you please tell me the proper solution or any other way in which i can save my XML file in TEXT format.

I would be grateful for your prompt reply.

Vipul Takalkar

Hi Vilpul,

Double quotes in expression are escaped by adding another Double quote next to it:

That said, I see no good reason for placing your templates in a static entity!

It's by far better to have it just hardcoded in an assign on your action than to put the database in the mix (expecially with such a big text)

So my recommendation is to at the begging of your action to set the value of a output variable  (or local variable) with the template text, directly on a assign node.

As another alternative if you need to reuse it in multiple places it to add it as a resource of your espace. This has a bit lower performance as the previous, but it allows reuse and an easier maintnance. (and its still way better than having it in the database)

João Rosado
Hi João,

Thank you for your attension to this matter. I think for me second way is better becouse i need to reuse it in multiple places

Vipul Takalkar
Hi João Rosado,

I m using XmlRecords Extension to replace my value in XML File. I prepare the neccesory actions.
Intially for Testing purpose i m feeding small part form XML

  <REQUESTING_PARTY _Name="All Western" _StreetAddress="123 Test Address" _StreetAddress2="" _City="Some City" _State="UT" _PostalCode="84020" />

and following actions are performed to replace City.

But problem is i get different format of XML file like

    <Name>All Western</Name>
    <StreetAddress>123 Test Address</StreetAddress>

can you Please tell me what should i do to get proper XML format
  <REQUESTING_PARTY _Name="All Western" _StreetAddress="123 Test Address" _StreetAddress2="" _City="Mumbai" _State="UT" _PostalCode="84020" />

As well as i attached my Oml file for reference

Vipul Takalkar
Hi Vipul,

I tested in my machine (note: it my local machine is in .Net and I can't guarantee that it also works in java since I did not test it there) and made the necessary fixes.

First for the fields to be serialized as attributes the name needs to be prefixed by what is configured in the "DefaultXmlConfig.AttributePrefix" (by default it is "Attr_").
So I added "Attr_" in all your configs:

Also in the RecorListToXml call I passed the configs, that was missing:

Lastly, it looks like there is a problem with the extension (at least in the .Net version) that is not considering the attributes for the "DefaultXmlConfig.ExcludeIfNull" check ....so since I changed everything to be attributes it thinks it is "null" and doesn't generate a output at all.
To overcome this I had to set the "DefaultXmlConfig.ExcludeIfNull" to false.

I'm uploading the changed version. See if it works for you.

João Rosado
Hi João,

Thank you very much for the prompt reply.

"DefaultXmlConfig.ExcludeIfNull" is working fine with me. I have one more doubt

what should i do if My root node comes with "_"
e.g. I have XML file as

Here ALIAS comes with "_", so shall i put Attr__ALIAS? or what should i do to work this?

Waiting for your reply.
Vipul Takalkar
Not sure if I understood the problem...
You should prefix with "Attr_" things that need to be written as an attribute in the xml.
The "_Alias" looks like a xml element node (not a xml attribute), right?

Yes _ALIAS is xml element node.
I followed your steps but i m not getting right xml file after REQUEST

In REQUEST there are child nodes may be that's why it won't get me result.
Can you figur out where am getting wrong.
I am attaching OML file also.

Thanks in advance.

I'm trying to publish the 'TestIDS 11-2-2015.oml' file and it seems that it is missing the components for XMLRecords. I tried refreshing the references, but it does not seem to work.
I've attached a screenshot of the problem.
Any form of help would be appreciated.


The XML Records can be downloaded in the forge: http://www.outsystems.com/forge/component-versions/153/XML+Records

João Rosado
Hi João,

Thank You for the quick reply. I appreciate Your help.
The application is working now. Though the output isn't what I was expecting it to be.
The XML is displaying as is in the IDSImport page, including the XML tags. I've attached the screenshot for your reference. 
I'm not sure if this is how it is supposed to display, or is it supposed to display in a table?

Can some one help me out on this 

I'm having the similar issue getting the values "for example on the _ALIAS" mentioned by João Rosado above...

 have to get the values which are dynamic in part of XML 

What has been completed so far is that I've created the structure of values which I would like to import inside the static mapped xml....


So what should we create the Entity with complete structure.... to get the data inside the system?