[XML Records] Xml to recordList

[XML Records] Xml to recordList

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

Hi,

We are having problems serializing the folowing XML on the <ValueList> item. We are using the XML Records version 1.5.8 in .Net. Can anyone provide a sample how to handle this case? 

<Records>
<Record number='1250' name='xpto'>
<Description>
descrição 1250
</Description>
<ValueList>
<Value>
Valor 01
</Value>
<Value>
Valor 02
</Value>
<Value>
Valor 03
</Value>
</ValueList>
</Record>
<Record number='1251' name='xpto1'>
<Description>
descrição 1251
</Description>
<ValueList>
<Value>
Valor 01
</Value>
<Value>
Valor 02
</Value>
<Value>
Valor 03
</Value>
</ValueList>
</Record>
</Records>


Thanks,

JP

Hi Joao,

What problems are you having? Have you attempted to replicate this in a more recent version of the extension? 1.5.8 is now over three years old.

Hi,

The problem is how to create the OS structure to deal with the <ValueList> item.



You need to create ValueStruct first, with attribute :

Value - Text


Then create RecordStruct with attribute:

Description - Text

ValueList - List of ValueStruct

Hi,

Your suggestion thus not work. Any other help?

Thanks,

JP

João,

Just to clarify, have you tried to use a more recent version than 1.5.8? Which OS version are you using?


Abílio Matos

Hi Abilio,

We are using OS 10.0.705.

We did not tried a new version than 1.5.3 because we are not able to update it now.

Thanks

JP

Hi Abilio,

We are using OS 10.0.705.

We did not tried a new version than 1.5.3 because we are not able to update it now.

Thanks

JP

Hello João,

Your structures should look like this:


When configuring the lists, make them as List of Record of Something, like so:





Hi JP, in parallel with JH above, I also created this respone for you ... JH just beat me to the post :)



In the Structure all the repeating elements need to be "List". The local variable needs to be a "Record List", see below;

  Hope it all works for you.


Regards, John.

Hi,

I've updated the XML records to the latest version 1.6.2.

Here is the XML that is giving me problems now:


"<Fields>
<Field number='641' name='teste'>
           <Description>
                    <![CDATA[Estado do registo]]>
           </Description>
           <ValueList>
                       <Value><![CDATA[TestValue]]></Value>
                       <Value><![CDATA[Em vigor]]></Value>
                       <Value><![CDATA[Anulado]]></Value>
             </ValueList>
       </Field>
</Fields>"


If I change it to:

"<Fields>
<Field number='641' name='teste'>
           <Description>
                    <![CDATA[Estado do registo]]>
           </Description>
           <ValueList>
                       <Value>TestValue</Value>
                       <Value>Em vigor</Value>
                       <Value>Anulado</Value>
             </ValueList>
       </Field>
</Fields>"

Works just fine:


It seems that the problem is related with the CDATA on the Value tag. But the CDATA dont bring any problem on the Description tag.

JP

Hi JP, the solution I sent through last night works perfectly for your given XML structure. Have you tried it? Do you want me to export the solution and send to you? 


Regards, John. 

HI JP, attached is the TestXML.oml file. Try it in debug mode through the 'preparation' flow. It should work for you.

Hi JR,

That works. The problem is with the folowing XML:

"<Fields>
<Field number='641' name='teste'>
           <Description>
                    <![CDATA[Estado do registo]]>
           </Description>
           <ValueList>
                       <Value><![CDATA[TestValue]]></Value>
                       <Value><![CDATA[Em vigor]]></Value>
                       <Value><![CDATA[Anulado]]></Value>
             </ValueList>
       </Field>
</Fields>"


Hi JP, I see your problem and I don't have an easy answer. Worst case is you treat the <Value> ... </Value> as text and extract the data you need via a script.

Hi JP, I just tried this XML  in my test harness and at first look it seems to have worked, see what you think;

<Records>
<Record number='641' name='teste'>
           <Description>
                    <![CDATA[Estado do registo]]>
           </Description>
           <ValueList>
                       ![CDATA[
                            <Value>TestValue</Value>
                            <Value>Em vigor</Value>
                            <Value>Anulado</Value>
                       ]]
             </ValueList>
       </Record>
</Records>

Regards, John.