Implement ISNULL(XmlNode)
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?
There is no IsNull check currently, but it is in our backlog,
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!
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.
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
XmlDocumentdo not have any root element, so trying to access it:if not document.GetRoot(rootElement) then … - for
XmlNodeListyou can check their size:if not nodeList.Count() = 0 then …; - for
XmlNodesI could imagine a combination of.IsXmlElement()and checking the node's name and if there are subnodes.
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.