RSS newsticker in native mSL (COM) - 07/04/20 11:14 AM
I've been trying to get this rss newsticker working using native msl and com. Half the trouble was finding the documentation, but Ouims was a great help.
This is what I have working so far:
If I type...
...then I get the raw xml echo-ed in my window as per the line: echo -ag $comval(b,%i,xml)
However I wish to keep parsing the xml using the MSXML2.DOMDocument.6.0 COM object and return the title, the link and the pubDate data. I've tried a variety of things using the visual studio object browser and the documentation online to look for ideas, but can't get anything working. I was wondering if someone out there can give me a hint...
This is what I have working so far:
Code
; URLGET RSS FEED -> BINVAR [x] ; BINVAR -> COM XML (MSXML) [x] ; COM XML -> PARSE DATA [ΒΌ] ; PARSE DATA -> NEWSTICKER WINDOW [ ] ; IXMLDOMElement Members ; https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms757048(v=vs.85) alias _rssfin { if (($1 isnum) && ($urlget($1).state == ok)) { if ($com(a)) .comclose a .comopen a MSXML2.DOMDocument.6.0 if ($comerr) goto :error echo -ag Load into XML (slurp): $com(a,LoadXML,3,&bstr, &slurp) - $com(a).result if ($com(b)) .comclose b echo -ag selectNodes: $com(a,selectNodes,3,bstr,//item,dispatch* b) if ($comerr) goto :error var %n $comval(b,0,selectNodes), %i 1 while (%i <= %n) { echo -ag $comval(b,%i,xml) ;parse data inc %i } :error if ($com(a)) .comclose a if ($com(b)) .comclose b } } ; https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url alias _rssget { var %pattern https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*) if (!$regex($1,%pattern)) echo 4 Invalid URL else noop $urlget($1-,gb,&slurp,_rssfin) }
If I type...
Code
/_rssget https://www.volkskrant.nl/voorpagina/rss.xml
...then I get the raw xml echo-ed in my window as per the line: echo -ag $comval(b,%i,xml)
However I wish to keep parsing the xml using the MSXML2.DOMDocument.6.0 COM object and return the title, the link and the pubDate data. I've tried a variety of things using the visual studio object browser and the documentation online to look for ideas, but can't get anything working. I was wondering if someone out there can give me a hint...