AL icon indicating copy to clipboard operation
AL copied to clipboard

Implement ISNULL(XmlNode)

Open dkorinets opened this issue 8 years ago • 5 comments

In C/AL we have such thing like: IF ISNULL(XmlNode) THEN EXIT(FALSE);

In my case it is quite useful function. How to check whether the XmlNode is initialized in AL?

dkorinets avatar Aug 29 '18 13:08 dkorinets

There is no IsNull check currently, but it is in our backlog,

kalberes avatar Sep 03 '18 09:09 kalberes

how to access each node one by one in AL? My XML Content [XmlText] snippet: <Access_Token> <Instance_Url>https://www.mywebsite.com/</Instance_Url> < YourToken>0_YdG/DRSVGCKyy6fx/fdasdY6avs=</ YourToken> <Expiration_date>05/28/2019 11:50:14 PM</Expiration_date> <Refresh_Token>0_i1G4fADRTVRDfdsac4GjD5R5UoOPks</Refresh_Token> </Access_Token>

Please give me AL code snippet if you have any.

Thanks in Advance!

TabrezAjaz avatar Oct 29 '18 02:10 TabrezAjaz

Hi! This issue is stale - sometimes great ideas go stale if not enough people talk about them. Please go ahead and post this to our Ideas forum at https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. We're constantly monitoring top Ideas and will consider them for a future release.

SBalslev avatar Aug 06 '25 06:08 SBalslev

Sometimes issues do not need to be discussed all time in order to be implemented as they are somewhat… essential. Still missing a complete migration-guide for those xml-things.

Nodes (unfortunately?) cannot be null by definition when using the xml datatypes, but you can check their contents. Here is a starter:

  • empty XmlDocument do not have any root element, so trying to access it: if not document.GetRoot(rootElement) then …
  • for XmlNodeList you can check their size: if not nodeList.Count() = 0 then …;
  • for XmlNodes I could imagine a combination of .IsXmlElement() and checking the node's name and if there are subnodes.

KOTRET avatar Aug 08 '25 06:08 KOTRET

Great feedback - we're not investing in xml changes right now but put it on BCIdeas then it will be part of our ideas backlog.

SBalslev avatar Aug 08 '25 11:08 SBalslev