[XML Records] XmlToRecordList issues with deserialization of XML

[XML Records] XmlToRecordList issues with deserialization of XML

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

Hi all,

I have a XML, that is working fine with XmlToRecordList except for this little piece:

<informacao_economica>
    <justificacao />
    <sem_info_financeira>False</sem_info_financeira>
    <imobilizacoes_incorporeas>
      <valor>210</valor>
      <valor>10</valor>
      <valor>10</valor>
    </imobilizacoes_incorporeas>
<previsionais>False</previsionais>
<reais>False</reais>
</informacao_economica>


It's the "imobilizacoes_incorporeas" part that is giving me issues.

I made a structure for "informacao_economica":

justificacao - Text
sem_info_financeira - Boolean
previsionais - Boolean
reais - Boolean

but i cannot seem to get the structure/attribute right for "imobilizacoes_incorporeas". 


Can you guys help me with that?


Regards,

Abílio Matos

Hi Abílio, you could define a structure that contains one single attribute, namely valor of type Integer. Say you name this structure Imobilizacao_incorporea. Then you can add the attribute imobilizações_incorporeas to the structure informacao_economica and define it as a list of Imobilizacao_incorporea. This should work.


Cheers, pedro

Hi Pedro,

Thank you for your answer but that only brings the first "valor" of the list.


Abilio Matos

Hi Abílio, can you upload the espace in here so that we can take a look? Make sure that any confidential information is not present in the espace.  Could you also state the version of the platform server you are using?

Greetings, pedro

Hi Pedro,


I am using the ServiceStudio version 10.0.715.0 with personal environment, which is on 10.0.702.0.

The .OML is attached to this post.

Thanks again for your help.


Regards,

Abilio Matos

Solution

Hi Abílio, it is working right now, assuming you are using version 1.6.2 of XML Records. See oml attached. I don't know why but renaming the structure containing the attribute valor to valor solved the problem. 

My suspicion is that whenever you have a list of elements in the XML that don't contain any child elements, as is the case of the list of valor elements (each valor element does not have any child elements) you need to define a structure whose name is the same name as the one of the attribute in it. I would need to dive into the C# code to check whether this suspicion can be confirmed.

Hope this helps!


Greetings, pedro

Solution

Pedro,


Thank you very much. That solved the problem.


Abílio Matos

You're welcome. Nice programming!