[XML Records] Discussion

[XML Records] Discussion

  
Forge Component
(24)
Published on 15 Jun by Ricardo Silva
24 votes
Published on 15 Jun by Ricardo Silva

How can I see what has changed in the newer version or what the reason was for updating this version?
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.

Cheers,
Gonçalo
Hi Gonçalo,

I'm guessing this is about what I was searching for when posting this tread:
http://www.outsystems.com/NetworkForums/ViewTopic.aspx?Topic=XML-output-type

Thanks for this post and Nice icons!
Gonçalo,

Is there a way for NULL dates to be represented as:
     <datestamp></datestamp>
instead of
     <datestamp>1900-01-01T00:00:00</datestamp>
Hi Eric,

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
Hope it helps.
Gonçalo
Hi Gonçalo,

Thanks for taking the effort to make a parameter of the NULL value and implementing it as a default.
Hi Gonçalo,

From what I've read, this extension would fit our requirement perfectly. I've downloaded it but it looks like only versions later than 4.2 are supported.  Any possibility of adapting this for 4.2? 

Thanks!

John
Hi John,

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.

Cheers.
Hi Gonçalo,

I've seen that the RecordToXML action has two parameters that are non-mandatory:
- XmlConfig
- DefaultConfig

Are there any doc's around of how to use those parameters?

i.e. I'm looking for a base64 formatted text  output (instead of binary output); is that something I can directly convert to?
Hi Martha,

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 (available here: http://www.outsystems.com/NetworkSolutions/ProjectDetail.aspx?ProjectId=69 ) 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.

cheers,
Gonçalo
      
   


How can I change the entity name easily in the config?

Hi Joost,

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

Thanx for your reply, this was very helpfull!! :)

Hello,

Currently I have a recordlist, which consists of records with a date attribute.
When using the RecordToXml action, in the created xml it is transformed into a datetime:


<InvoiceDate>2010-08-03T00:00:00</InvoiceDate>


Is there anything I can do to turn it into a date withount the 'T00:00:00' ?

thanx!
Martha
Hi Martha,

A quick solution would be to use the Replace built-in function on the result:
Replace(ReturnedXML,"T00:00:00","").

Cheers,
Tiago Simões
Hi Martha,

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.

Cheers,
Gonçalo
Good change Conçalo,

Thanks again!
.NET Compilation..NET Compilation.
Gonçalo,

I'm getting below compile error:
 
..\ConsoleApplication1\ConsoleApplication1.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\ConsoleApplication1\ConsoleApplication1.csproj" failed. The project file "Z:\Extensions\XmlRecords 1.0.2\XmlRecords\Source\NET\..\ConsoleApplication1\ConsoleApplication1.csproj" was not found.
Z:\Extensions\XmlRecords 1.0.2\XmlRecords\Source\NET\XmlRecords.sln : error MSB3202: The project file "..\ConsoleApplication1\ConsoleApplication1.csproj" was not found.
XmlRecords.cs(20,121): warning CS1573: Parameter 'ssDefaultConfig' has no matching param tag in the XML comment for 'OutSystems.NssXmlRecords.CssXmlRecords.MssRecordListToXml(object, OutSystems.NssXmlRecords.RLRecordXmlConfigRecordList, OutSystems.NssXmlRecords.RCDefaultXmlConfigRecord, out string)' (but other parameters do)
XmlRecords.cs(53,113): warning CS1573: Parameter 'ssDefaultConfig' has no matching param tag in the XML comment for 'OutSystems.NssXmlRecords.CssXmlRecords.MssRecordToXml(object, OutSystems.NssXmlRecords.RLRecordXmlConfigRecordList, OutSystems.NssXmlRecords.RCDefaultXmlConfigRecord, out string)' (but other parameters do)
XmlRecords.cs(72,97): warning CS1573: Parameter 'ssXmlConfig' has no matching param tag in the XML comment for 'OutSystems.NssXmlRecords.CssXmlRecords.MssXmlToRecordList(string, object, OutSystems.NssXmlRecords.RLRecordXmlConfigRecordList)' (but other parameters do)
XmlSerializerConfig.cs(15,54): warning CS0429: Unreachable expression code detected
CopyFilesToOutputDirectory:
 XmlRecords -> Z:\Extensions\XmlRecords 1.0.2\XmlRecords\Source\NET\bin\OutSystems.NssXmlRecords.dll
 
..\ConsoleApplication1\ConsoleApplication1.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\ConsoleApplication1\ConsoleApplication1.csproj" failed. The project file "Z:\Extensions\XmlRecords 1.0.2\XmlRecords\Source\NET\..\ConsoleApplication1\ConsoleApplication1.csproj" was not found.
Z:\Extensions\XmlRecords 1.0.2\XmlRecords\Source\NET\XmlRecords.sln : error MSB3202: The project file "..\ConsoleApplication1\ConsoleApplication1.csproj" was not found.
XmlRecords.cs(20,121): warning CS1573: Parameter 'ssDefaultConfig' has no matching param tag in the XML comment for 'OutSystems.NssXmlRecords.CssXmlRecords.MssRecordListToXml(object, OutSystems.NssXmlRecords.RLRecordXmlConfigRecordList, OutSystems.NssXmlRecords.RCDefaultXmlConfigRecord, out string)' (but other parameters do)
XmlRecords.cs(53,113): warning CS1573: Parameter 'ssDefaultConfig' has no matching param tag in the XML comment for 'OutSystems.NssXmlRecords.CssXmlRecords.MssRecordToXml(object, OutSystems.NssXmlRecords.RLRecordXmlConfigRecordList, OutSystems.NssXmlRecords.RCDefaultXmlConfigRecord, out string)' (but other parameters do)
XmlRecords.cs(72,97): warning CS1573: Parameter 'ssXmlConfig' has no matching param tag in the XML comment for 'OutSystems.NssXmlRecords.CssXmlRecords.MssXmlToRecordList(string, object, OutSystems.NssXmlRecords.RLRecordXmlConfigRecordList)' (but other parameters do)
XmlSerializerConfig.cs(15,54): warning CS0429: Unreachable expression code detected
CopyFilesToOutputDirectory:
 XmlRecords -> Z:\Extensions\XmlRecords 1.0.2\XmlRecords\Source\NET\bin\OutSystems.NssXmlRecords.dll
Gonçalo,
Enclosed XIF seems to work for us.

Thanks Eric, 
Forgot to remove the tester project from the solution ;)
V1.0.2 is updated. Cheers
Hi Gonçalo,

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.

Please let me know what you think about these features.

Cheers,

Nuno Guedes.
Hi,

I have to use this extension but in an environment with 4.2 platform server.
So just like Gonçalo says, I have to copy-paste the code and it works fine.

I upload the extension to who needs this in 4.2.

Best Reggards,
Nuno Mendes
Hi,

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.

Cheers,

Nuno Guedes.
Dear Gonçalo,

I hope you can help me out with this 'localization' issue.

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-dd instead 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 a way to add an XML header per default to the XML output of RecordToXml?

Currently I'm manually adding:
<?xml version='1.0' encoding='windows-1252'?>
In order for our Jasper Report server to be able to handle € (Euro) signs.

It would be nice if the XMLRecords extension would have a "Add header" boolean parameter.

Hi all,

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
================================================

  <Folder Id='Legend'>
   <name>Legend</name>
   <open>1</open>
   <Placemark>
    <name>color:#A1 92.1 dB(A)</name>
    <open>1</open>
    <styleUrl>#LegendIcon</styleUrl>
    <LineString>
    </LineString>
   </Placemark>
  </Folder>
  <Folder>

   <name>CPX Segments</name>
   <Placemark>
    <name>Segment 1: 92.1 dB(A)</name>
    <open>1</open>
    <LineString>
     <coordinates>52.1,5.1</coordinates>
    </LineString>
   </Placemark>
  </Folder>

Hi Vernon, 

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.
Hi Nuno,

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!

Hi,

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
Hi Gonçalo,

Thanks for the new version.
I'm currently working on a project in which I can use this added functionality.
I'll test it the next few days.

Regards,

Eric
Goncalo,

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?
Hi Joost,

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" :)
atm I prefer the tag <Recordlist> indeed.

will think about it more later on.

(cannot edit the code myself atm, since I don;t have VS on the machine I'm working on, yes I know, shocking it is)

btw, need to ipp the latest osp.. can you fix that as well?


hi again,

when doing record2xml, a recordlist of 2 entities only exports one entity.
is this by design, or a bug?
Hi Joost,

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.

I'll merge this in the published component version.
Cheers
Hi,

oops, made a typo there, it is a recordlist2xml which I'm doing.

Attached an example of the issue I have.
It's a recordlist of 2 entities, where only one entitie is being processed by the xml2records.

My recordlist is Foo,Bar

the result is
<Foo>
<attributes></attributes>
</Foo>
<Foo>
<attributes></attributes>
</Foo>


while I epected
<Foo>
<attributes></attributes>
</Foo>
<Bar>
<attributes></attributes>
</Bar>
<Foo>
<attributes></attributes>
</Foo>
<Bar>
<attributes></attributes>
</Bar>
Joost,

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/>
Attached is the oml (I hope).

the recordlist definition has got 2 entities, so I kinda expect a list looking like this:

<list>
<recordlistrecord>
<entity1>...</entity1>
<entity2>...</entity2>
</recordlistrecord>
</list>

Hi Joost,

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 :))
Hi,

We have solved it in a similar matter.
So thanks for the fast reply and enjoy the xmas ;)
Every time I try to publish this solution I get the following error :

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?

Any chance of an unprotected version ?
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
Hi!

I'm trying to use this extension to parse XML in the following form:

<section>
    <title>
        title title title
    </title>
    <content type="text">
        text text text
    </content>
<section>

To achieve this, I have created the following structures:

section
    title : string
    content : record of the type 'content'    <----- I need a record here to accommodate the 'type' attribute of the content

content
    Attr_type : string
    content : string

This doesn't work as I need. Creating a section record and serializing it through RecordToXml, the result is:

<section>
    <title>
        title title title
    </title>
    <content>
        <content type="text">
            text text text
        </content>
    </content>
<section>

(indentation added for clarity)

I have tried to mess with the XmlConfig parameter of the RecordToXml, but I've got nothing. Any idea on how to get this to work?
Hi Filipe,

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!
Thank you very much, Gonçalo, it is working link a charm.

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?

Thank you very much!

~Filipe Silva
Yup, me again...

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).

For example, I have a list of elements like this:

<Field active="1" date="10-11-2010">
    <OtherStuff stuff="blabla" />
</Field>

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 

<Field xmlns="test" active="1" date="10-11-2010">
    <OtherStuff stuff="blabla" />
</Field>

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).

Thank you very much.

~ Filipe Silva
Hi Filipe,

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?

Once again, thank you very much.

~Filipe Silva
Hello Filipe,

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?

Thanks,

Nuno Guedes
Hi, thanks for the quick answer.

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)
Hi Filipe,

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.

Cheers.

Nuno Guedes.
Thanks for looking, Nuno.

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.
And I found the solution to my problem!

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.

Great work, and thank you for your help.

~ Filipe Silva

Hi!
 

I have the following XML as the result of an external WebService call:


<WSNAME>
    <SUBMITSTATUS>Success</SUBMITSTATUS>
    <TABLE NAME="T1">
        <ROWSET>
            <ROW NAME="N1" VALUE="V1"></ROW>
            <ROW NAME="N2" VALUE="V2"></ROW>
            <ROW NAME="N3" VALUE="V3"></ROW>
        </ROWSET>
    </TABLE>
</WSNAME>


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


What I'm doing wrong?


Best Regards,
Luís Dias

Hi Luis,

Check if this post from Gonçalo Borrega also addresses your question:

Hi Eric,

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
Hope it helps.
Gonçalo


Let us know how it goes.

Regards,

Paulo Tavares
Hi Paulo,

Thanks for your reply.

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.

Thanks,
Luís
Hi Luís,
It was a defect. I fixed it and just uploaded a new version of the extension. Wanna give it a try?
cheers
Hi Gonçalo,

Thanks for the fixed version. Everything is working as expected.

Cheers,
Luís 
Gonçalo,

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.

Have you tested the extension on v6 already?

Regards,

Eric
Hi Eric,

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 ;)
Hi Gonçalo,

I've managed to modify the structure so XMLRecords was able to cope with it.
The issue seemed to be in the interpretation of a nested structure.

Input XML:
<NAME Id="24" Entity_id="19" legal_basis="77/2009 (OJ L 23)" reg_date="2009-01-27" pdf_link="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:023:0005:0024:EN:PDF" programme="ZWE">
<LASTNAME>Kasukuwere</LASTNAME>
<FIRSTNAME>Saviour</FIRSTNAME>
<MIDDLENAME/>
<WHOLENAME/>
<GENDER>M</GENDER>
<TITLE/>
<FUNCTION>Deputy Minister for Youth Development &amp; Employment Creation</FUNCTION>
<LANGUAGE/>
</NAME>


I've created a function to "Expand" the attributes to a nested XML which makes:
<NAME>
    <NAME_attributes>
    <Id>24</Id>
    <Entity_id>19</Entity_id>
    <legal_basis>77/2009 (OJ L 23)</legal_basis>
    <reg_date>2009-01-27</reg_date>
    <pdf_link>http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:023:0005:0024:EN:PDF</pdf_link>
    <programme>ZWE</programme>
    </NAME_attributes>
<LASTNAME>Kasukuwere</LASTNAME>
<FIRSTNAME>Saviour</FIRSTNAME>
<MIDDLENAME/><WHOLENAME/>
<GENDER>M</GENDER>
<TITLE/>
<FUNCTION>Deputy Minister for Youth Development &amp; Employment Creation</FUNCTION>
<LANGUAGE/>
</NAME>


This was mapped to ENTITY_NAME in 5.1.1.17 to:
Old

I have now mapped it to ENTITY_NAME in 6.0.0.4 having the following structure:
Hi,

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.

Can you give some help here?

Thanks,
Gonçalo Chora
Hi Gonçalo (Chora),

I can confirm to have experienced the same situation you have.
The I guess this is something that can be fixed in the Extension.

Regards,

Eric
Hi,

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 Norbert,

The component has an espace with it that shows how to use the extension and how to use most of the available parameters. It should help.
Hi Gonçalo,

Thanks for your help, now everything is clear.
Hi Gonçalo,

Can you please help me with the following:

I want to create a XML from this structure.




The record list contains several Companies, Locations, Products. The XML that is generated by the RecordtoXML function contains only one product per Location. The other products are ignored. 

Can you please take a look at this?

If you need any more information regarding this issue please contact me.

Thank you in advance.

Rene
Hi Rene,
I've never had that problem. Did you fill the Location.Products RecordList properly (with the ListAppend)?
Can you provide an example espace where the problem is replicable?
The record list is filled correctly, I checked while debugging.

Attached the Screen Action example 'CreatePDForXML'
.


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:

<Item>&lt;Receiver&gt;
&lt;ReceiverID&gt;1234&lt;/ReceiverID&gt;
&lt;/Receiver&gt;
</Item>

Instead of:

<Item><Receiver>
<ReceiverID>1234</ReceiverID>
</Receiver>
</Item>

Which is obviously not desired.
Another question: I'm trying to rename some tags when using RecordToXml, but only the outermost tag is renamed. What is the syntax for RecordName when having nested records?
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 Kilian,
have you tried the CDATA section to escape special characters?
I've used in the past to nest XML into another XML, and it worked just fine.
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.
Hello Gonçalo,

First of all many thanks for this great component. It's very usefull.

Question 1) It's possible to define namespace "names"? Or it's always used only "xmlns"?

The result i'm searching it's something like this:

<abc:Identificacao xmlns:abc="http://www.test.com/Test">
    <abc:NomeCompleto>Carlos Alexandrino</abc:NomeCompleto>
    <abc:DataNascimento>1950-01-12T00:00:00.000+01:00</abc:DataNascimento>
    <abc:Sexo>M</abc:Sexo>
</abc:Identificacao>

Question 2) It's possible to remove an empty record if all attributes are null?

In a XML like this:

<RenamedGroup>
    <Name>The group name</Name>
    <HomeAddress>
        <GroupAddress>
        </GroupAddress>
    </HomeAddress>
</RenamedGroup>

Obtain:

<RenamedGroup>
    <Name>The group name</Name>
</RenamedGroup>

Question 3) I have ExcludeIfNull="True" and empty integer attributes are showed as <number>0</number>. In this case shouldn't it be exluded?

Thanks.
Hi,

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
Just uploaded v 1.2.3 which fixes the defect reported by Eric (here) and Gonçalo Chora (here)
Hope it helps
Cool!

Thanks for this fix, Gonçalo!

(Doing a microwave currently)
Hi there,

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,

I'm not sure what the problem is you're experiencing. I tried to encode a simple structure with one member, and it encodes like this (using RecordListToXml):

<st_TestXml>
 <Name>Joe&apos;s Pizza</Name>
</st_TestXml>

When I convert it back (using XmlToRecordList), in the record list it's "Joe's Pizza" again. So it works like a charm.


Kilian


Hi Kilian,

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".

Something like <Name>Joe&apos;s Pizza</Name> besides <Name> Joe's Pizza </Name> It's not valid in the Stored Procedure.


Thanks.

Best Reggards,
Nuno Mendes
Hi Nuno,

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.

Best regards,


Kilian
Hi Nuno,

I can agree with Kilian here.
The display of the John Doe&#s is probably due to the editor you're using.

Make sure you use the EncodeHtml() function on the text fields so it converts the ' to &apos;

This should fix your issue.

Cheers,

Eric
Hi guys,

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,

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.

Best regards,


Kilian
Nuno Mendes wrote:
Hi guys,

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
Nuno Mendes wrote:
Hi there,

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?
Nuno Mendes wrote:
Hi guys,

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... :)
 
Hi guys,

Thanks for your advices. We are currently trying the approach mencioned by Chinita.
Don't ask me why but the client wants the XML like I said in the post. :-S

I will post if that solves our issue.


Thanks for your help.

Best Reggards,
NM
Dear all,

First of all I’m new to Outsystems.

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?

Thanks in advance.



Hi Paulo,

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.
Kilian Hekhuis wrote:
Hi Paulo,

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:
  1. In SS 7.0, opened XmlRecorsExample.oml file
  2. SS detected that the OML file was saved on SS 5.1.1.11 and started an upgrade
  3. After loaded the XmlRecorsExample SS detected that the eSpace had some incompatible or missing references. And it opened “Add/remove References” to update them.
  4. I’ve refreshed the missing object
  5. 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.

Paulo Castro







How about when you upgrade and install the extension (XIF) first and then link the OML to that extension. :)

The OML references the Extension and if it's not there you get these kind of errors.
Yeah, it seems like the stuff defined in the extension isn't referenced.
Hi Paulo,

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.

Regards,
João Rosado
Hi,

first, thanks all for the support.

@João: it sound that your right. I cannot publish new extensions on my trial version. I'll install the community edition and try it again.

Regards
Paulo
Hi,

i think you can help me. I got a problema that I need to parse a xml to record list. I was reading thoose post above, but no one is like my xml instruction.
I got one like this:

<?xml version="1.0" encoding="utf-8"?>
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
  <s:Schema id='RowsetSchema'>
    <s:ElementType name='row'
                   content='eltOnly'
                   rs:CommandTimeout='30'>
      <s:AttributeType name='ows_LinkTitle'
                       rs:name='Title'
                       rs:number='2'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
      <s:AttributeType name='ows_AnnotationID'
                       rs:name='Annotation ID'
                       rs:number='3'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
      <s:AttributeType name='ows_MediaPath'
                       rs:name='Media Path'
                       rs:number='4'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
      <s:AttributeType name='ows_TimeCode'
                       rs:name='Time Code'
                       rs:number='5'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
    </s:ElementType>
  </s:Schema>
  <rs:data>
    <z:row ows_LinkTitle='my first test item'
           ows_AnnotationID='b3cd9a8c-e7d1-439e-b910-a94e1d91f406'
           ows_MediaPath='http://localhost, http://localhost/media1.wmv'
           ows_TimeCode='00:00:03.1234567' />
  </rs:data>
</xml> 
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 guys,

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)'.

Does anyone have any clue of what might causing this error?

Thanks in advance for your help.
PEDRO SOARES wrote:
Hi,

i think you can help me. I got a problema that I need to parse a xml to record list. I was reading thoose post above, but no one is like my xml instruction.
I got one like this:

		<?xml version="1.0" encoding="utf-8"?>
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
  <s:Schema id='RowsetSchema'>
    <s:ElementType name='row'
                   content='eltOnly'
                   rs:CommandTimeout='30'>
      <s:AttributeType name='ows_LinkTitle'
                       rs:name='Title'
                       rs:number='2'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
      <s:AttributeType name='ows_AnnotationID'
                       rs:name='Annotation ID'
                       rs:number='3'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
      <s:AttributeType name='ows_MediaPath'
                       rs:name='Media Path'
                       rs:number='4'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
      <s:AttributeType name='ows_TimeCode'
                       rs:name='Time Code'
                       rs:number='5'>
        <s:datatype dt:type='string'
                    dt:maxLength='512' />
      </s:AttributeType>
    </s:ElementType>
  </s:Schema>
  <rs:data>
    <z:row ows_LinkTitle='my first test item'
           ows_AnnotationID='b3cd9a8c-e7d1-439e-b910-a94e1d91f406'
           ows_MediaPath='http://localhost, http://localhost/media1.wmv'
           ows_TimeCode='00:00:03.1234567' />
  </rs:data>
</xml> 
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
 
Gonçalo Borrêga wrote:
 
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 made the change that you said, but stil doesn't work.

 
Hi everyone,

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.

For example, taking the given structure

"<Group testAttribute="TestAttribute">
    <Name>The group name</Name>
    <CreationDateTime>2012-12-27T14:54:12</CreationDateTime>
    <SimpleDate>2012-12-29</SimpleDate>
    <StartTime>15:54:12</StartTime>
    <Decimal>1.12345678</Decimal>
    <HomeAddress>
        <Street>The home street</Street>
        <HouseNumber>15</HouseNumber>
    </HomeAddress>...."

i wanna add the attribute Type="Date" to the CreationDateTime record so it turns like this:

"<Group testAttribute="TestAttribute">
    <Name>The group name</Name>
    <CreationDateTime Type="Date">2012-12-27T14:54:12</CreationDateTime>
    <SimpleDate>2012-12-29</SimpleDate>
    <StartTime>15:54:12</StartTime>
    <Decimal>1.12345678</Decimal>
    <HomeAddress>
        <Street>The home street</Street>
        <HouseNumber>15</HouseNumber>
    </HomeAddress>...."

How can we do this with the configuration file?

<XmlConfig>
    <RecordXmlConfig RecordName="Group"
        EffectiveName="RenamedGroup" Namespace="http://www.outsystems.com">
        <AttributesConfig>
            <AttributeXmlConfig Name="IsActive" AttributeName="IS_ACTIVE"/>
            <AttributeXmlConfig Name="HomeAddress" RecordMode="C"/>
        </AttributesConfig>
    </RecordXmlConfig>
    <RecordXmlConfig RecordName="User"
        EffectiveName="MyUser" />
</XmlConfig>
And another doubt... is it possible to tranform the first node from something like

<Group>


into

<n1:Group xmlns:ns1="http://..." xmlns:n1="http://...">

again using the configuration file?
C. Oliveira wrote:
   - Method not found: 'Boolean OutSystems.HubEdition.RuntimePlatform.Db.RecordList.op_Equality(OutSystems.HubEdition.RuntimePlatform.Db.RecordList, OutSystems.HubEdition.RuntimePlatform.Db.RecordList)'.
 
 
Cláudio,
v1.3 solves this problem. The extension is now compatible with v7.0.0.18+
 
Hi guys,

Please close this thread... There is already a large set of topics going on here, which makes it hard to look for information or understand to which particular post each answer applies to.

If you want to ask a different question please Start a new Thread in the component discussions.

I think that will help us to better find our answers and distill the questions

Some answers:
 - Namespaces in elements (question from Pedro Miranda)
 - Attributes vs Child elements (question from Pedro Miranda)
 - Importing from a Sharepoint-like Rowset XML (question from Pedro Soares)
Hi, 

I need help with XML to Structure mapping.
I posted a discussion below:
http://www.outsystems.com/forums/discussion/12517/xml-de-serializing-problems/

Pasting here as well:

Here is the scenario, we have an XML that looks like:
 
<a>
                <b>
                                <c></c>
                                <d></d>
                <b>
                <e>
                                <f></f>
                                <g></g>
                </e>
                <e>
                                <f></f>
                                <g></g>
                </e>
                <e>
                                <f></f>
                                <g></g>
                </e>
                <m>
                <n>
</a>
 
The repeating <e> in above XML does not map to the corresponding RecordList in Structure, however <b>, <c> <d>, <m> and <n> does.

Looks like some config needs to be done but not able to figure what and how.

Thank you in advance.

Hi Goldy Lukka,

Try to add one XmlConfig with the following structure:
RecordXmlConfig
  RecordName: "a"
  AttributesConfig
    Name: "e"
    RecordListMode: "S" /* this will make the "e" attribute behave as a sequence and maybe it should solve your problem */

Thanks Claudio,

The problem is little more complex, I have <x>, <y> and <z> as parents of <a>.
How do I configure the RecordXmlConfig in that case? Would it remain same?
Hi, 

I am not able to make it work yet.
Can someone please suggest? Ricardo, please?

Thanks.
Goldy,

Maybe you can create a master structure and sub-structure for childs. And with an Component RecordListToXml, they can compile all with your structures completely.

I´ll try make an example on Cloud Suite for you.

Keep in touch
Thanks CMateusTech (sorry I did not see your name in your profile).

Sorry ... Goldy ... im so busy this days ... but today i´ll try make the solution that i suggested ok?
bellezza... obrigado!
Hi All!
Can you point me to some .oml where I can see some fuctionalities of xmlRecords being used?
Hi André!

In Version 1.3 it's available one Sample eSpace, you can download and see it in use.

Hope it helps you!

Best Regards.

Daniel Martins.
Hello,
I had am problem in converting XML to RECORDLIST.The recordlist function is not working properly.
 
For eg 
<?xml version="1.0" encoding="utf-8" ?>
<RESPONSE>
  <KEY _Name="ExperianFairIsaac_MinimumValue" _Value="320" />
  <KEY _Name="ExperianFairIsaac_MaximumValue" _Value="844" />
  <KEY _Name="CreditScoreRankPercent_CreditResponse1_CreditScore13" _Value="57" />
 
This is the value which i have to convert as recordlist but the problem am facing is only the first value i'm able to receive,The rest 
of the values are not updating i'm getiing the same data for every thing like this is how i get when i post
 
<?xml version="1.0" encoding="utf-8" ?>
<RESPONSE>
  <KEY _Name="ExperianFairIsaac_MinimumValue" _Value="320" />
 <KEY _Name="ExperianFairIsaac_MinimumValue" _Value="320" />
 <KEY _Name="ExperianFairIsaac_MinimumValue" _Value="320" />
 
Please find my OML file for your reference .
 
Regards,
ChandrasekarRadhakrishnan
Hi,
I'm new to this outsystems,Can any one tell how to save data from xml in server studio because i'm not able to link the tables properly.
Regards,
ChandrasekarRadhakrishnan
Chandrasekar Radhakrishnan wrote:
Hi,
I'm new to this outsystems,Can any one tell how to save data from xml in server studio because i'm not able to link the tables properly.
Regards,
ChandrasekarRadhakrishnan
 Chandrasekar

You can store the XML data into your database just like storing any regular text/string.


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.

Cheers,
Gonçalo
 
 
Hi Chandrasekar,

What are you trying to achieve? XML is just text, you can store that in the database just like any other text.
Hello,
Hi i have atttached a simple xml file can you show me
how to save those data in OS database Or else this is the xml data which i have mentioned below
<RESPONSE_GROUP MISMOVersionID="2.3.1">
  <RESPONDING_PARTY _Name="MCL DEMO" _StreetAddress="1124 BRISTOL STREET" _City="COSTA MESA" _State="CA" _PostalCode="92626">
    <CONTACT_DETAIL>
      <CONTACT_POINT _RoleType="Work" _Type="Phone" _Value="7147086950"></CONTACT_POINT>
      <CONTACT_POINT _RoleType="Work" _Type="Fax" _Value="7147086956"></CONTACT_POINT>
    </CONTACT_DETAIL>

Regards,
ChandrasekarRadhakrishnan
Hi,
Can you show how to save a simple xml data in OS database.
Regards,
ChandrasekarRadhakrishnan