This is not an upgrade to the existing Serialization_XmlToRecordList. You can still use that when you just use serialization/deserialization in the specific format that the XML extension applies.
This component aims to serialize records in a more "standard" xml notation. In time, the configuration parameter will even support more arguments allowing to fine tune the output of the serialization (for instance having an attribute serialized as an XML attribute of the parent element instead of a child element) and so on. This came mainly from the necessity of having to import XML given by a third party in their specific format instead of having to apply complex xml transformations before we could read them, and also to be able to generate XMLs in the third partiy's specific format as long as you have a record structure that goes along with their format.

If you check the example espace on the new component you'll be able to see the difference in formats generated/read by this component as opposite from the Xml components.

Thanks for the feedback. Keep it coming :)
You could do this by adding, in argument "XmlConfig" a RecordXmlConfig for the record you are serializing, with an AttributeXmlConfig for your datestamp attribute with parameters ExcludeIfNull = False and NullValue = "1900-01-01T00:00:00

However, I think this should be the default for DateTime, Date and Time attributes, so I have uploaded v1.0.1 with two changes:

The default null value for dates is the NullDate of the platform

There is a new argument for the RecordListToXml and RecordToXml called DefaultConfig, where you can set if by default "Null values" are excluded and what is the default for child Recordlists

I'm pretty sure the C# implementation works on 4.2, although I never tested it. From what I remember the breaking changes are supported by the code in the extension.

I don't have VS 2005 neither a valid version of Integration Studio 4.2, and there is no way to "downgrade" an extension, but all you have to do is just replicate the structures from the 5.0 version (you can use the current Integration Studio community version), replicate the actions and copy/paste the code in the extension.

Let me know if you face any problems in this process and I'll probably be able help you out.

Unfortunately I haven't produced any documentation other than the description of the parameters (and attributes of the structures).I'll try to give a small brief on what they do:

DefaultConfig: It's a structure with the default behaviour that the extension will get when serializing records. It has two attributes:

ExcludeIfNull: when True, excludes elements that are empty in a structure, where empty means "equal to the NullableValue". The NullValue can be specified for each attribute if you like, but basically is 0 for numbers, NullDate() (1900/01/01) for Date, Time or DateTime attribues, and an empty string for every other attribute.

RecordListMode: C or S (Child or Sequence). When you have a Record "Master" with an attribute "ChildList" that is a RecordList of "Child" Records, when RecordListMode is set to C the output will be something like <Master><ChildList><Child>...</Child><Child>...</Child></ChildList></Master>. When it is set to S, the output will be <Master><Child>...</Child><Child>...</Child></Master> (ommits the parent element of the recordlist.

XMLConfig: It is a recordlist of RecordXmlConfig. It is basically an hashtable with a set of setting that you can add for specific Records. The record can be the name of the structure/record (in ou previous example "Child") or an hierarchical name ("Master/Child"). The extension, when serializing will look for the hierarchical name from bottom up. If it finds "Master/Child" it will apply those settings, if not, it will look for a "Child" config. If not found, it will use default settings. The settings list should be a list of records of type AttributeXmlConfig and each has the following attributes:

Name: is the name of the attribute you are configuring

AttributeName: If set it allows you to rename the attribute when exporting to xml

ExcludeIfNull: Allows overriding the default ExcludeIfNull setting for the current attribute.

NullableValue: Let's you tell that for the current attribute the nullvalue should be -1 instead of 0 for example.

RecordListMode: Let's you set that on this specific attribute (in case it is a RecordList) what should be the export mode (Child or Sequence)

Hope this makes the settings a bit clear. Remember that you can use the extension itself to provide you thise settings filled from an XML:

Ex: Try calling the extension's XmlToRecordList of the following XML and use the result as the input for the DefaultConfig parameter

<DefaultXmlConfig>

<ExcludeIfNull>False</ExcludeIfNull>

<RecordListMode>S</RecordListMode>

</DefaultXmlConfig>

Regarding your question on base64: My suggestion is that you add an attribute of type Text to the structure you wish to export, then use the "BinaryData" extension to fill that attribute with the BinaryDataToBase64 result of your binary, and then just export the structure as usual with the RecordListToXml... Base64 is just binary data encoded as text, so it will be a normal attribute.

Currently it is not possible. I'll try to add that possibility, assuming it will also work for importing a xml to a recordlist based on that name. If eventually you change the extension please post it.
cheers

Version 1.0.2 just uploaded already solves the "bug" of the Dates with 00 timestamps (both reading and writing XML). I had the same problem a few days ago so it was already done...

This is a breaking change however I decided to make it the standard because if you use this in any xml that requires schema validation (invoking a webservice for instance) the T00:00:00 is considered invalid.

This version also allows for applying a specific namespace to a record when exporting to XML.

@Joost... changing the entity name is not forgotten, just waiting for 15 more days because now I can only test it with 5.1 and I would like to keep it in 5.0.

First of all congratulations for your work on this awsome component, the idea is amazing and its functionality is very usefull.

When i first try this component i ment to deserialize a real world XML into outsystems structures therefore i found some problems:
1-The XML declaration "<?xml" conflicts whith the root directory of the document raising an exception while importing
2-Deserialization of attributes is not supported
3-Serializarion of attributes is not supported
4-If the document contains a namespace the import is unsuccessefull
5-if the elements are rendered in Sequence mode, they can not be imported to the record list

So i have open your extension and solved the problems listes above, the solutions were:
1-I Added a InputParamenter in XMLToRecordListAction named IgnoreXMLDeclarationAndNS that defaults to true,
and removes from the document the namespace and XML declaration if they exist
2-I added an Input Paramenter called AttributePrefix in XMLToRecordList Action that defaults to "Attr" and alows to search in attributes whenever the field names
of the structures starts with that prefix
3-The same way for Serialization, a added an attribute in DefaultXMLConfig Record hat defaults to "Attr" and alows to render attributes whenever the field names
of the structures starts with that prefix
4-The first solution topic solves this problem too
5-When Deserializing, the extension tries to retrieve a record list searching the child elements, but when the result list is empty,
now the extension tries to fill the record list with the childs of the parent selected by the name of the record list field.

With these features we can now import and export to outsystems structures XML from the real world and not just XML that have been Serialized from outsystems structure model.

I have attached a zip file with these modifications either in the extension and the example OML.

I have attached another version where i simply changed the default attribute prefix to "Attr_" instrad of "Attr", i just realize thar most xml have their attributes and elements in lowercase, with this new default prefix the structure fields can now be more readable.

Currently when I check the output given either through a webservice or trough the XmlRecords with a download, I'm getting the following output:
<TestXML>
<Date>2010-08-16</Date>
<DateTime>2010-08-16T13:08:32</DateTime>
<Currency>1234,56</Currency>
<Decimal>1234,56</Decimal>
<BooleanTrue>True</BooleanTrue>
<BooleanFalse>False</BooleanFalse>
<Text>This is a text field used for testing purposes.</Text>
</TestXML>

In this example there are 4 fields that are to be logically 'interpreted' by an (internal or external) XML parser.
Looking at the Date, DateTime, Money and Decimal fields there needs to be a certain formatting:
Date/DateTime : e.g. mm-dd-yyyy /yyyy-mm-dd / dd-mm-yyyy (possibly also having either a "-" or a "/" as a field separator)
Currency/Decimal : e.g. 1234,56 / 1.234,56 / 1234.56 / 1,234.56

I'd think the export format should be depending on the country locale that is set.
Currently I have no idea how I should modify the output format other than converting
all these fields to a Text type and create my own functions to convert the format.

I have tried the SetCurrentLocale function but this doesn't seem to have any influence on the formatting.

Besides that, I'm unsure how the current format is determined.
On the Platform Server we've set everything to nl-NL (Dutch setting); the Currency seems to be ok, but the Date format is still yyyy-mm-ddinstead of dd-mm-yyyy

In a future setup we will probably have Platform servers in other countries besides the Netherlands (e.g. Singapore / United States / Germany / UK etc).
We'd like to be able to swap the XML locale using a function like SetCurrentLocale so the export would get a different formatting.

Is there someone who can help me with the following? I am trying to generate KML files to be opened with Google Earth. I am using the XmlRecords extension to get this done. Hereunder you'll find a "Fraction of the expected output for the KML file".

The problem that I have now is that all Placemarks tags are appended to the first Folder instead of distributed over the 2 folders as shown below. Since I am using the ListAppend action while I am iterating to populate the structure and sub-structures (from which the KML file will be generated with the XmlRecords extension), I was wondering if there is a way (in the form of some sort of built-in action or extension) that I can use to go to the next row in the Folder-list and append the Placemarks to the correct Folder?

It might be handy to know (a portion of) the hierarchy of the structures that determines the layout of the resulting KML file:
<kml> - Main Record
<Document> - Record <Folder> - Record List
<Placemark> - Record List

Attached you'll find an oml-file with the logic in question. Note that the oml-file was created using Service Studio 5.1.

You're help will be much appreciated!

Regards,
Vernon

================================================Fraction of the expected output for the KML file
================================================

I have attached a oml that hopefully solves your problem, the idea is to move the folders after the list is populated, i was unable to test it because we don't have a Platform Server 5.1, but i was able to edit-it in service studio. Please let-me know if worked for you.

Thanks! In the code you adapted I saw you referred to the indexes by using brackets like this: [index_number]. By applying that to my code instead of the keyword "Current" solved my problem for me. Once more thanks!

Just released a new version (v 1.1) of the component.
The full details of the changes are described in the version release info.

@Joost, you're now able to change a record's name, through the EffectiveName property in the RecordXmlConfig structure. Check the example espace and the new screenshot attached to the component, I'm doing it there.

@Eric, your localization issue is, hopefully, solved. There are a set of new properties in the default config which allow to set a culture for writing and reading decimals, as well as the format for DateTimes, Dates, and Time. (Time has a limitation, it must contain : as a separator). Be aware that if you change this, standard webservices receiving this XML will not be able to read it... it should only be used for custom exchange... (in case you're thinking.. that's why I chose not to bind it to the platform/environment's locale)

@Eric, there's also support for the XML declaration tags. Check it out in the example

Hope this helps!!
If you find any defect just let me know... or if you can fix it and post... even better ;)
Cheers
Gonçalo Borrêga

I have an export of a recordlist that i place in a document.
looks roughly like
<element>
<more></more>
</element>
<element>
<more></more>
</element>
<element>
<more></more>
</element>

however, when I upload the same file again and with xml2recordlist I get the exception of having multiple root-elements,
which I understand ofc.
but this means that recordlist2xml and xml2records are not 1on1, which should be. is this a bug?

They should be 1-on-1 indeed. The problem is that .Net is not able to load XML without a root element; and I rather export it without a root element, allowing you to add it manually, than adding a dummy xml root element.
As such I decided to only make 1-on-1 the RecordToXml with XmlToRecordList (you serialize a record with a recordlist inside it, and deserialize it back to the recordList alone).

How would you prefer?

To always surround when exporting with a <RecordList> tag (this is the way .Net does for instance when you save DataSets to XML)

To have an optional input on both actions that state the name of the root element? It would export normally and put a "<root>" element surrounding the items and ignore that when importing?

To have some workaround to .Net's way of working so that we can read XML without a root element

All three of them have problems (you might need namespace support, XML with no root element is still an invalid XML, etc...)
Currently you'll need to be aware of this, and handle it manually...
Do you have any other idea of how it should work? Feel free to change the code... I can integrate it back or add you to the component's "team" :)

If I understood you correctly you're calling RecordToXml setting the first parameter 'Record' with a ToObject(yourRecordList). Am I correct?
That will, by design, only export the first record. In fact I was not even aware it would work; I designed it to only expect a record list as a parameter.

If you want to export a RecordList of type structA with RecordToXml, you need to enclose it in a structure (structB) and use a variable of type Record->structB to export
That will yield
<structB>
<structA>....</structA>
<structA>....</structA>
</structB>

Right now I can't remove the IPP (my only 5.0 infra is IPP protected)
Cheers

I took the opportunity to make a small change to the extension to support what Joost mentioned on 29.11 regarding the 1-on-1 between RecordListToXml and XmlToRecordList.

As I mentioned the only way to do that is by adding a root node over the RcordList nodes. On v1.1.1 of the component there is now an optional parameter 'AddRootNode' on the RecordListToXml action that will surrond the output with a root element <RecordList>. It goes by default as False (due to backward compatibility) so no changes in the output Xml are expected if you don't set it to true.

So with the example Joost used with <element> and <more>, if you set AddRootNode to true, the output will be:
<RecordList> <element>
<more></more>
</element>
<element>
<more></more>
</element>
<element>
<more></more>
</element>
</RecordList>

This way you'll be able to seemingly use XmlToRecordList directly over the serialized Xml to obtain it back to a variable of the same type (be aware that if you use the exact same variable, the extension appends to the list; doesn't remove items that are already there...

XmlToRecordList also has a new optional boolean parameter (BypassRootRecordListNode) that defaults to true, to consider the root <RecordList> as internal, and only look inside its child nodes for the elements to deserialize.

Did you forget the attachment or was it the example described?
Can you send me (DM maybe?) an example with the recordlist you want to serialize?
Bear in mind that I'm looking at the recordlist definition to serialize it to text, so if you have a recordlist of "objects" of different types, they will be serialized always considering the definition of the model/espace record/recordlist attributes.
I'm saying this because I do not understand from what kind of recordlist you would expect a <Foo/> <Bar/> <Foo/> <Bar/>

Thanks. Now I see what you mean.
That is currently not supported... only records of a single type :(
However you can achieve the same result by defining a parent structure to hold the combined values. I changed your espace to do just that and the output is the following:

Will this do?
If you really need that change I can tell you where the extension code should be changed to support that (and add you to the component dev team) as I will not be able to make that change very soon (Xmas weekends :))

You are trying to Upload or Publish a Solution that was created in a Platform Server with a different License than Platform Server and its Intellectual Property is Protected.<br/>You cannot Upload or Publish Solutions with Protected Intellectual Property that were created in Platform Servers with a License different than the Platform Server one.

I get this on v5.1.1.5. I assume the new license that comes with the latest community versions (the ones with 30K SU instead of 75K SU) is involved?

Hello Hans,
This is not related to the license. It is because the espace/solution has an intelectual property protection.
You just need to go to www.outsystems.com/ipp, upload it there with your activation code (if you have the community version then it is 000.000.000.000.000.000.000.000) and you'll receive an unprotected version in your email.
cheers

I did not support XML content on a parent record... but I added the feature just now.
You now have a property named ContentPrefix on the DefaultXmlConfig structure that defines what will be the records attribute that will be used to set and read the direct contents of its XML tag. By default this prefix is "Cont_", so if you add an attribute Cont_Value to your Content structure you'll get the desired behavior.

Attached the extension version that supports this as well as an example espace that does just what you want!
Happy new year!

I've made a little change in the extension for it to allow the values "1" and "0" for specifying true or false in the XML, since the XML I need to handle is in that format. After checking the XML Schema definition, turns out 1 and 0 are legal boolean values, so I attached the changed extension to this post hoping it is helpful (and if you don't find it a problem, Gonçalo, update the "official" extension).

If I may nag a little bit more... I'm having problems with converting a date attribute to a Date field in a record list's record.
I'll post two questions, in fact:

1) I receive an XML file with one of the elements' attributes being in the Date format "dd/mm/yyyy". I've put this format (in both caps and non-caps) in the DefaultConfig attribute of the XmlToRecordList action, but I keep getting a "String was not recognized as a valid DateTime". However, if I change both the DefaultConfig and the xml test file's attribute to "dd-MM-yyyy" the conversion works. Is this some problem with the "/" character?

2) I've noticed that for the date value "10-11-2010", the date format "dd-MM-yyyy" (capitalized M's) will render the Date value "10-11-2010", but if the format used is "dd-mm-yyyy" the Date value returned is "10-01-2010". Is this behavior expected, or is it a bug?

I've noticed a bug (at least, I think it is) in the XMLToRecords action.
The bug is that if an element has a xmlns attibute defining its namespace, the action won't return any values for the other attributes of that element (but the element's children are converted perfectly, at least with IgnoreXMLDeclarationAndNS set to True).

Defining all necessary options in the action configuration, I get a perfect Record List of Field entities, with attributes Active set to True and Date set to "#2010-11-10#". Field's child OtherStuff is also defined correctly. However, if I change it to

the extension returns a Record List of Field, with OtherStuff defined correctly as well, but with Active and Date set to null values (false and "#1900-01-01#", respectively). This happens even if I set the xmlns attribute to xmlns="", so it's not a simple namespace problem.

It would be nice if someone could check into this (I've tried looking into the extension a bit, but couldn't find what is happening here).

Thanks for the support for 1/0 as True/False in extension. I've integrated it in the current solution

Regarding your question on DateFormat:
- The / is being considered as the current culture date separator. I could force the culture to be ignored, but it might break compatibility with existing users, so I'll give you the "workaround": Instead of using dd/MM/yyyy use dd'/'MM'/'yyyy. this will force the / as being identified by .Net as a real / instead of the separator defined in the server's Regional Settings
- Yes, there is a difference between dd/mm/yyyy and dd/MM/yyyy. the lowercase mm are the minutes the uppercase MM the months. The documentation for the several formats is at http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

Regarding the namespace, it is (was) a defect. I changed the logic to use RegularExpressions to remove the namespace attributes.
Attached the extension with these changes.
Have fun.

Thank you very much, Gonçalo, I had no idea of that DateFormat detail. That'll be useful.
Let me congratulate you for the great extension this is. It saves a ton of work when dealing with XML.

However (I'm starting to feel a bit of a nagger, here), I've got another problem, this time with RecordListToXML.
I've set the parameters correctly so that attributes will be placed correctly into the appropriate records' fields when converting from XML to a record list. When I re-convert that record list back to XML, however, the result is not what I expected. The fields that correspond to attributes are being rendered as child elements to the record element
(e.g.:<parentElement>
<attribute1>1</attribute1>
<attribute2>Lorem ipsum</attribute2>
</parentElement>

instead of<parentElement attribute1="1" attribute2="Lorem ipsum" />).

I've set (both for the XML to recordlist and recordlist to XML, they use the same configuration) the XMLConfig parameter with the necessary information to render the attributes as record's fields, but it doesn't seem to work the other way around. I've tried setting the AttributePrefix and change the records' field names, but it didn't work either (actually, it was worse - all the field values came up empty).

My question is: setting the XMLConfig with the necessary RecordXmlConfig and AttributeXmlConfig properties to map the attributes to record fields, shouldn't the conversion from and to XML work in the same way? That is, converting XML to a recordlist and then back again should result in the same XML code or, at least, a compatible version.
Am I doing something wrong or overlooking something?

EDIT: I now noticed that re-re-converting the XML without the attributes (the "wrong" one) to a record list results in the same record list as the first (the "correct" one). I guess the extension doesn't really care if child nodes are attributes or child elements. Or was I just confused by the naming ("AttributeXmlConfig" leads me to believe that the configuration concerns elements' attributes), and was supposed not to include the attributes in XmlConfig but just add the prefix to their record fields instead?

Currently the extension identifies xml attributes by its "Attribute prefix" and all the tests that i made export the attributes correctly. Can you please provide an oml example that reproduces your problem in order to find it and fix it quickly?

Attached is an oml with three examples (all in the web screen's Preparation action, set a breakpoint at the end of that action to check the values):
- One of how I had things previously (the example with the A structures), without attribute prefixes but hoping the XMLDefinition would take care of that;
- One working as expected (the example with the B structures), with attribute prefixes and that render the XML correctly;
- Finally, a somewhat simplified copy of why I need this, in which I tried to copy the 'B' example (added attribute prefixes and updated the XMLConfig), but that still renders attributes as children elements.

I may be doing something differently, but if I am I can't notice it, I've looked closely at the two final examples and all the configuration seems the same.
If you can spot the reason for this behavior, I would be very grateful.

Thank you very much!

~Filipe Silva

P.S.: In my opinion, "AttributeXmlConfig" can be a misleading name, since it got me thinking that it would handle the attributes correctly by itself (thus removing the need for the attribute prefix)

Unfortunatly i dont have access to a 5.1 environment so i was unable to test it, however i open it with service studio 5.1 and as far as i can see, your A structure fields dont have the attribute prefix on its name, so if you rename them to attr_id and attr_name respectively the export behaviour should be correct.

However, my problem is not with the A structures, but with the 3rd example (the one with CustomField, etc., which is a bit more complicated, and that may be the cause for my error, whatever it is). Earlier that example had the structure of the one with the A structures (no attr_ prefixes). But now I've added them to the structures' field names (so it is (I think) like the B structures example) and the XML still comes up with children elements instead of attributes.

Basically I just needed to set the names of the structures' fields to exactly "attr_" (my attribute prefix) + the name of the attribute on the xml. Then I could remove the attributeConfigs for those attributes from the xmlConfig, because they are no longer needed. Now it works perfectly.

My error was, as (I think) I've already mentioned, thinking that placing the attributeConfigs would handle the attributes, but apparently it does so only when converting from XML, not to it. Maybe this is a bug or, if not, "attributeConfig" should be named differently.

I would like to be able to convert XML to Record Lists with completely custom names (without a mandatory attribute) for the records' fields, but for now, I'll take the slightly "uglier" names for the usefulness of this extension.

When I try to deserialize the XML to a RecordList everything is fine except for the attributes of the ROW nodes that are empty.
If I change the ROW nodes so thet they aren't empty (<ROW NAME="N1" VALUE="V1">.</ROW>) the ROW attributes return values

Thanks for the feedback. Keep it coming :)
You could do this by adding, in argument "XmlConfig" a RecordXmlConfig for the record you are serializing, with an AttributeXmlConfig for your datestamp attribute with parameters ExcludeIfNull = False and NullValue = "1900-01-01T00:00:00

However, I think this should be the default for DateTime, Date and Time attributes, so I have uploaded v1.0.1 with two changes:

The default null value for dates is the NullDate of the platform

There is a new argument for the RecordListToXml and RecordToXml called DefaultConfig, where you can set if by default "Null values" are excluded and what is the default for child Recordlists

The XmlConfig in the eSpace that I attached is just a starting point. It can be edited in runtime to test different configurations. I already tried several XmlConfig’s with or without the suggested AttributeXmlConfig without success.

I have several XLM's that are far more complex, and in every one of them, all elements are correctly mapped except for de attributes of empty nodes.

I've just migrated an E-space which is using the XMLRecords extension to version 6
of the platform and it now has issues converting the exact same XML file.
The error I get is the default Object reference not set to an instance of an object.
I'm not familiar with .NET environment testing so I can't debug this in-deep.

I've used it already with some structures in v6 (accessing the twitter feed).The Example also runs ok. It might be related to some setting. Any chance you can send the xml and espace that imports it? Any more detailed stacktrace? Maybe I'll be able to take a look at it or someone else in the community ;)

I was using XmlToRecordList action to read the following xml:<ROOT>
<PSUBMITSTATUS>
<PRETCODE>0</PRETCODE>
<PRETMESSAGE>25000******Parameter 'PREMFREQUENCY' is/are exceeding the maximum length</PRETMESSAGE>
</PSUBMITSTATUS>
</ROOT>

into a RecordList that should support the xml:<ROOT>
<PSUBMITSTATUS>
<PRETCODE>0</PRETCODE>
<PRETMESSAGE>25000******Parameter 'PREMFREQUENCY' is/are exceeding the maximum length</PRETMESSAGE>
</PSUBMITSTATUS>

<QUOTE>...</QUOTE>
<SIMU>...</SIMU>

</ROOT>

that has two additional nodes wich are records (<QUOTE> and <SIMU>), and it returns the error:"Object reference not set to an instance of an object."
So the thing that I think is going wrong is that, no elements of type Record can be missing from the xml if there are any correspondent elements in the structure.

I've tryed it on version 5.0 and 6.0 of the Outsystems Platform and the error is the same.

Does anyone could show me how I can use this "plugin" and generate xml file? I would be thankful if somebody will attach eSpace with used plugin or explain step by step how I can use XML Records. I am from Poland so sorry for my english if I made some mistake.

Hi Rene, I couldn't actually test it, but by looking at the code it may be related with the fact that you're doing ListClear on the RentDueProductList.
You assign the RentDueLocation.S_JASPER_RENTDUE_LOCATION.Products with RentDueProductList and afterwards you ListClear the RentDueProductList.
That will probably remove the items from the recordlist. You should, instead, assign RentDueLocation.S_JASPER_RENTDUE_LOCATION.Products with a ListDuplicate(RentDueProductList) so that a new instance of that list is created. RecordList are reference variables, so they are not duplicated by default.
Can you try that? Private Message me if you need to follow up. Cheers

Is there an option to disable the escaping of special characters? Due to the limitations of 5.0 and web services, I need to add XML (output of RecordToXml) to a Text attribute, then apply RecordToXml to the whole, without the Text attribute being escaped. It now comes out as:

And a final question: it seems that decimal values of 0.0 are not treated as null values. Is this intentional? (Disclaimer: I'm using 1.1.1 currently, since I'm on 5.0 and have not yet had luck downgrading 1.2.2 due to strange problems.)

Ok, I managed to downgrade the latest version to 5.0, debugged the code a bit, and found the answers to my questions:
1) It is indeed not possible to avoid escaping of special characters, the way the extension is implemented currently;
2) The alias only works for the outermost tag, but not for tags for sub-records, even if they are records themselves;
3) Numeric values do not have a default null-value that gets them ignored, like text fields have. It seems that for dates, it is more or less by accident the nullvalue gets ignored (because the conversion to a string yields a zero-length string, which is ignored further on).

Hi António, the extension uses SecurityElement.Escape to escape the string, so it's done on a different level. I could easily remove that from the code of course, but I'd rather make a nicer solution (using the element config).

Just to note, issue #2 above is not an issue, but a misunderstanding on my part. I have to use the attribute config instead of the XML config for these tags. The other two problems I have dealt with by modifying the code to suit our needs.

1) That is currently not possible. You'd have to change the extension to be able to control that.
2) The ExcludeIfNull="True" setting is the one that controls that. You can set it by default and override it in the configs for each attribute.
3) There is also one configuration "NullValue" which determines what should be the value to consider null (0 in this case). If I recall correctly I've made it possible to set it by default in the default parameters.

Try to check this post for details on what you're trying to achieve.
The example espace also tries to show some of the configurations you're trying to do in 2) and 3).
Hope this helps

Yes, it works fine the problem is that I'm using the RecordListToXML, to generate the XML and send it to another system to a Stored Procedure that is expecting a XMLType attribute. But the XML must go "decoded".

Though I'm not an XML expert, I don't think <Name>Joe's Pizza</Name> is valid XML. Quotes should always be escaped. That said, I've extended the extension for private use within our company, because we needed to include XML within tags and so escaping was no option (amongst other things). It seems however I cannot attach a file here, so I can't attach it.

Yes but what I want is absolutely the opposite I want to the function RecordListToXml to not encode the ' into &apos. I want to stay exactly the way I put it in the Record. If I send in the record John Doe's, I want the XML to stay <Name>John Doe's</Name> besides something like <Name>John Doe&aposs</Name>.

Is there any option on the extension. Or the extension must be changed to do something like this?

Again, having an apostroph in the XML is not valid XML. The extension produces valid XML, and you ask for it to produce invalid XML. If you really want this anyway, yes, you need to modify the extension. As I've explained in my post above I have done exactly that (but for a different reason), but I cannot attach the changed extension here, otherwise I would've done so.

Yes but what I want is absolutely the opposite I want to the function RecordListToXml to not encode the ' into &apos. I want to stay exactly the way I put it in the Record. If I send in the record John Doe's, I want the XML to stay <Name>John Doe's</Name> besides something like <Name>John Doe&aposs</Name>.

Is there any option on the extension. Or the extension must be changed to do something like this?

Best Reggards,
NM

Nuno,

I wouldn't steer on the XML Extension to be changed since this is -as far as I know- non-common behaviour.
I guess you could try the other XML Extension (named just XML) which is far more complex but I wouldn't be surprised if that one also replaces the quotes.

Since having a 'neutral' XML communication would work in your advantage I'd strongly advise you to search for solutions at the other end.The receiver of the XML should be able to cope with HTML encoded strings; you shouldn't change an exchange 'protocol' because of the limitations of the receiver.

If you really want to send over an XML without escaped content you could try to use a CDATA approach:
http://xml.silmaril.ie/specials.html

I'm currently doing a project, and using this component. However in some situations like if we have a name like John Doe's it will encode the XML and stays something like John Doe&#s.

Exists some work-around to this feature?

Thanks.

Best Reggards,
Nuno Mendes

Hi Nuno. :)

Have you tried wrapping your string around a CDATA element? Eg. "<![CDATA["+ User.Name + "]]>"
Or, if that doesn't work, implementing HTML Decode in an extension and applying the function to the text result of RecordListToXml , before sending the data to the external system?

Yes but what I want is absolutely the opposite I want to the function RecordListToXml to not encode the ' into &apos. I want to stay exactly the way I put it in the Record. If I send in the record John Doe's, I want the XML to stay <Name>John Doe's</Name> besides something like <Name>John Doe&aposs</Name>.

Is there any option on the extension. Or the extension must be changed to do something like this?

Best Reggards,
NM

Hi Nuno,

Indeed if you want to change that behavior you'll need to change the extension.
The logic that does that transformation is in file TypeMapper.cs, in line 89 (where it goe through all types to transform them to their XML compliant string equivalent)

...
else

{

return SecurityElement.Escape(value.ToString());

}
The SecurityElement.Espace is the .NET action I used to convert invalid xml. ou can check what it does at the MSDN site as well as the actual characters that are not allowed in XML.
As a bunch of people already mentioned, you'll get invalid XML if you remove it... It is very odd that your receiving end (stored procedure?) is not able to parse this... otherwise how will it distinguish a < that belongs to a name from a < that is closing an XML tag... double check that requirement... :)

I’m trying to open “XML.Records-1.2.3.1.osp” in Service Studio 7.0. It started to publish the solution to my server and it all seems to be ok. However, at the end I can’t publish or run the solution since it is missing some references (see attached image).

What could I be doing wrong? How can I replace the missing references?

Did you actually open the XmlRecorsExample eSpace in Service Studio? If you do, and you have broken or missing references, SS will ask you whether you want to fix those, and open the reference dialog. There you can check what's wrong.

Did you actually open the XmlRecorsExample eSpace in Service Studio? If you do, and you have broken or missing references, SS will ask you whether you want to fix those, and open the reference dialog. There you can check what's wrong.

Hi Killian,
Thanks for your feedback.

Yes, I’ve opened XmlRecorsExample eSpace in Service Studio.
Here are the steps that I’ve performed:

In SS 7.0, opened XmlRecorsExample.oml file

SS detected that the OML file was saved on SS 5.1.1.11 and started an upgrade

After loaded the XmlRecorsExample SS detected that the eSpace had some incompatible or missing references. And it opened “Add/remove References” to update them.

I’ve refreshed the missing object

Even after refreshing, some objects still missing (see attached image)

Could this be related with the upgrade to the SS 7.0 ?
Thanks in advance.

Actually your problem is that the XML Records includes an extension and one limitation of the Trial servers is that you cannot publish new extensions there.
You could install a Community edition on your machine http://www.outsystems.com/download/full/ and try it there.

When I try to use Xml Records component, I got a msg, that unable to load the xml or the node (xml) doesn't match with the list(on this case i 've checked like 10000 times if the attributes are the same even in the list).

I've downloaded the last version (v1.2.3.1) and open it with the Integration Studio v7.0.0.18. Upgrade was done and no errors were given.

I've published the upgraded extension and refreshed the consumers using the "RecordToXml" action.

In runtime when the action "RecordToXml" is called, it raises the following error: - Method not found: 'Boolean OutSystems.HubEdition.RuntimePlatform.Db.RecordList.op_Equality(OutSystems.HubEdition.RuntimePlatform.Db.RecordList, OutSystems.HubEdition.RuntimePlatform.Db.RecordList)'.

When I try to use Xml Records component, I got a msg, that unable to load the xml or the node (xml) doesn't match with the list(on this case i 've checked like 10000 times if the attributes are the same even in the list).

Does anybody has any advice?

Thank's!!

Hi Pedro,

Try to replace in the xml text the namespaces... e.g. replace "s:" by "s", "rs:" by "rs". And afterwards name the attributes as rsname, rsCommandTimeout, etc. To parse the XML, the extension doesn't take into consideration the namespace (as it would require a lot of configurations to map Structure attributes to xml elements.
That might help

When I try to use Xml Records component, I got a msg, that unable to load the xml or the node (xml) doesn't match with the list(on this case i 've checked like 10000 times if the attributes are the same even in the list).

Does anybody has any advice?

Thank's!!

Hi Pedro,

Try to replace in the xml text the namespaces... e.g. replace "s:" by "s", "rs:" by "rs". And afterwards name the attributes as rsname, rsCommandTimeout, etc. To parse the XML, the extension doesn't take into consideration the namespace (as it would require a lot of configurations to map Structure attributes to xml elements.
That might help

i was looking at the example given and i was started "playing" with the use of configuration to understand it better and i was wondering it it's possible to add attributes with this file and how you do it.

Hi Robert,
Thanks for responding.My problem is this is my xml file which i have attached somehow i need to save this values in the OS database.I have converted this xml into excel and then imported into the OS db.So how to apply one to many relationship in this can you explain me so that i can able to modify.
Regards,
ChandrasekarRadhakrishnan

Hi,
Can any one explain me of how to save response xml file in OS db.
Regards,
ChandrasekarRadhakrishnan

Hi Eric,

This is not an upgrade to the existing Serialization_XmlToRecordList. You can still use that when you just use serialization/deserialization in the specific format that the XML extension applies.
This component aims to serialize records in a more "standard" xml notation. In time, the configuration parameter will even support more arguments allowing to fine tune the output of the serialization (for instance having an attribute serialized as an XML attribute of the parent element instead of a child element) and so on. This came mainly from the necessity of having to import XML given by a third party in their specific format instead of having to apply complex xml transformations before we could read them, and also to be able to generate XMLs in the third partiy's specific format as long as you have a record structure that goes along with their format.

If you check the example espace on the new component you'll be able to see the difference in formats generated/read by this component as opposite from the Xml components.

Apart from you replying to a > 3 year old topic, you also posted your original question on the general forum, instead of the component's subforum. Also, I already replied 6 days ago, but you never supplied the information I asked for.