How to handle XML result in D365 Business Central?

Hello Everyone,
I am working on API and wrote code in CAL for accessing each XML tag value. But now I want to write code in AL, but don’t know how to write. Please help me:

My XML Content [XmlText] snippet:

https://www.mywebsite.com/
0_YdG/DRSVGCKyy6fx/fdasdY6avs=
05/28/2019 11:50:14 PM
0_i1G4fADRTVRDfdsac4GjD5R5UoOPks

For reference you can look into my previous CAL code:
getToken(XmlText : Text) : Text
XmlDocument:=XmlDocument.XmlDocument;
XmlDocument.LoadXml(XmlText);
XMLNodeList := XmlDocument.GetElementsByTagName(‘Access_Token’);
count:=XMLNodeList.Count;

//First for loop to iterate the Access_Token Node– START
FOR I := 0 TO count – 1 DO BEGIN
DOMNode := XMLNodeList.Item(I);
TempXMLNodeList:= DOMNode.ChildNodes;
childcount:= TempXMLNodeList.Count;
DOMChildNode:=TempXMLNodeList.Item(I);
FOR J := 0 TO childcount – 1 DO BEGIN
DOMChildNode:=TempXMLNodeList.Item(J);
IF ( FORMAT(DOMChildNode.NodeType)=’Text’ ) OR ( FORMAT(DOMChildNode.NodeType)=’Element’ ) THEN BEGIN
CurrentElementName:=DOMChildNode.Name;
IF CurrentElementName = ‘Instance_Url’ THEN BEGIN
Instance_URL := DOMChildNode.InnerText;
END
ELSE IF CurrentElementName = ‘YourToken’ THEN BEGIN
TOKEN := DOMChildNode.InnerText;
END
ELSE IF CurrentElementName = ‘Expiration_date’ THEN BEGIN
Expiration_date := DOMChildNode.InnerText;
END
ELSE IF CurrentElementName = ‘Refresh_Token’ THEN BEGIN
Refresh_Token := DOMChildNode.InnerText;
END
END; // END of major If condition
END; //Second for loop to iterate the child nodes Access_Token Node — END
END;//First for loop to iterate the Parent or first node : Access_Token Node — END

Thanks in Advance.

Please tell or share code to read XML node values in AL, Most of the Features are not working.

There is a lot of way to do this.

One way (if it is simple XML) use XMLBuffer table

XMLBuffer.Load(iStream);
XMLBuffer.SetRange(Type, XMLBuffer.Type::Element);
repeat
    case XMLBuffer.Name of
        'MyFirstXMLTAB':
            begin
               //Some Code
            end;
        'NextXMLTag':
            begin
                //Some new code
            end;
    end;
until XMLBuffer.Next = 0;

Or you could for more complex type use XMLDocument type in AL (https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-restapi-overview)