[XML Records] [XmlRecords] ExcludeIfNull Problem

[XML Records] [XmlRecords] ExcludeIfNull Problem

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

Hi there!


I'm not able to show a spefic empty tag. In this Case, PHONES

Config:

<RecordList>
  <RecordXmlConfig>
    <RecordName>getCustomers_filter</RecordName>
    <AttributesConfig>
      <AttributeXmlConfig>
        <Name>PHONES</Name>
        <ExcludeIfNull>False</ExcludeIfNull>
        <NullableValue></NullableValue>
      </AttributeXmlConfig>
    </AttributesConfig>
  </RecordXmlConfig>
</RecordList>


Result:

<getCustomers_filter>
  <NAME>Francisco</NAME>
</getCustomers_filter>


Can anyone help understand why? 


getCustomers_filter structure has 2 text attributes: PHONES and NAME


I'm using version 1.6 of XmlRecords


Cheers,

Francisco

Hello Francisco,

are all your lists "Record Lists" or "Lists"? That is the "old" format before OS introduced the new List type?

Hello João,


I'm using "List"s as you can see in screen shot. "Local" is the "Element" passed to "ListAppend"


Hmm... try converting them to "old" style.

Same result:


Can you provide a sample .oml?

Here it is, thanks!

Are you passing the config in the XmlConfig parameter? In your example it's going empty...

Yes I am :)



The "XmlToRecordList" is just to convert the "RawXMLConfig" into XmlConfig. The RecordListToXml serializes to XML and is used in the test screen TestXML

I give up... 20 versions trying to figure it out. I'm gonna sleep on it :D

I didn't understand what you mean by 20 versions :)

Hi João,


Did you had a chance to look at this?


Cheers,

Francisco

Hi, no I haven't. But I'm still dreaming about it...

I'll give it another shot later...

Francisco,

can you see if it's this (see attached oml)?

I eliminated some of your conversions and simplified a bit... I can get the empty PHONES tag.

Thanks for your effort João but...

Using default config in RecordListToXml (your approach) works in this small example but my real use case is much more complex and and can't set the "DefaultConfig.DefaultXmlConfig.ExcludeIfNull" to False.

My goal was to use XmlConfig instead and set ExcludeIfNull to False just to "PHONES"

What I am missing?

I gave it another try without success. I'm starting to think it may be a bug.

I'm gonna ask for help...

I believe it is a bug, but...

Hi Francisco, 

any news on this subject?

Hello all,

I had the same bug. The problem happens when:

  1. DefaultXMLConfig - ExcludeIfNull attribute is true;
  2. AttributeXMLConfig - ExcludeIfNull attribute is false for the attribute that you want to exclude.

I opened the extension and found the reason of that. The XML is generated by the AttributeXMLConfig and at the end it excludes the attributes with the nullable value according to the DefaultXMLConfig structure.

So even if you set the ExcludeIfNull of the attribute to false, it will always be excluded. 

That could be fixed checking the list of AttributeXMLConfig when the list is beign checked for by the DefaultXMLConfig. And it would override the default behaviour.