[XML Records] Error trying to Generate XML: Sequence contains no matching element

[XML Records] Error trying to Generate XML: Sequence contains no matching element

  
Forge Component
(29)
Published on 5 Feb by Afonso Carvalho
29 votes
Published on 5 Feb by Afonso Carvalho

Hi All

We are using XML Records to generate a XML file (SEPA). We are trying to generate a file that contains lists inside lists and we have records that appear in multiple structures.

We are getting this error: Sequence contains no matching element

  at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)

  at OutSystems.NssXmlRecords.TypeMapper.GetSimpleRecordInfo(IRecord rec, String& recName, ISimpleRecord& structValue, FieldInfo& recordTypeSubfield)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.RecordXmlSerializer.Serialize(IRecord rec, String parentHierarchy, Boolean excludeRecordDefinition, StringBuilder parentSB)

  at OutSystems.NssXmlRecords.CssXmlRecords.MssRecordToXml(Object ssRecord, RLRecordXmlConfigRecordList ssXmlConfig, RCDefaultXmlConfigRecord ssDefaultConfig, String& ssXml)

[2:39 PM]

Has anyone got something similar?

Hi Pedro,

I could replicate the error you mention while using the latest version of the XmlRecords extension (1.6.1). The problem has to do with the fact that the extension assumes that the Record type is only being used to wrap structure/entity types. Apparently, you are passing a Record containing only attributes with simple types (e.g. Text, Integer). Instead of using the Record type, define a structure instead and add to it all the attributes that you have in the record. Then set the type of the attribute to this new structure instead of the Record type. This should solve the problem.


Note:

In previous versions of this extension, every structure/entity type had to be wrapped within a Record in order to be able to transform it into xml. This is no longer the case, though. You can safely pass structures/entities to have the corresponding xml generated. The extension only supports the Record wrapper construction for backwards compatibility.


greetings,

pedro