[XML Records] How to handle boolean attribute in XmlToRecordList
Service icon
Forge component by Afonso Carvalho
Application Type

I am using the XmlToRecordList action to convert an XML to a structure. In the XML (and corresponding structure) there are multiple boolean attributes. The corresponding attributes in the structure are always set to false, even if the corresponding tag is existing in the XML. How should I convert a boolean tag in an XML to an boolean attribute in a structure?

In the below example, the corresponding boolean attributes are set to false. The attributes should be false when the tags are not existing in the XML and true when the tages are existing in the XML.


Hi Eric Kuijper,

Are you setting the value in XML as true/false or 0/1?

Hi Nitish,

The XML file is created externally. In fact, we are talking about thousands and thousands of XML files with this structure. In the simple example, when <readAccess/> is present, the boolean attribute should be set  to true. When <readAccess/> is not present (optional tag), the boolean attribute should be set to false. I have not set any default for the corresponding boolean attribute in the structure in OS.



Hello Eric,

As far as I know, according to the XML Schema, there is no provision for a default value for booleans within an XML definition. While the tag is present, since it is self closing and has no attributes, it ends up representing a false value.

If you're attempting to parse business specific XML with its own set of non-standard rules, my advice would be to try and process these specific values by evaluating the string itself.

Hi Afonso,

Thanks for your reply. Not what I was hoping for but I will follow up your advice. Should work.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.