Addons/general/pcall/test disp

From J Wiki
Jump to navigation Jump to search
   require 'general/pcall/disp'

   p=. disp 'MSXML2.DOMDocument'
     'async' put__p 0
++
||
++
     'loadXml' do__p '<a b="q123">test</a>'
1
     'xml' get__p ''
<a b="q123">test</a>

     q1=. disp 'documentElement' get__p ''
       'getAttribute' do__q1 'b'
q123

       q2=. disp 'createElement' do__p 'c'
         'setAttribute' do__q2 'b';'z456'
++
||
++
         'appendChild' do__q1 <<P__q2
+--------+
|33129552|
+--------+
         'xml' get__p ''
<a b="q123">test<c b="z456"/></a>

       destroy__q2''
0
     destroy__q1''
1
     q1=. disp 'selectSingleNode' do__p 'a/c/@b'
       'text' get__q1 ''
z456
     destroy__q1''
0
     q1=. disp 'selectSingleNode' do__p 'qq/zz'
       P__q1
0
       'text' get__q1 :: (smoutput@(13!:12 bind'')) ''
|disp is null: assert
|   ERR_NULL     assert P~:0

     destroy__q1''
0
     info__p''
IXMLDOMDocument2   NB.
BSTR nodeName   NB. name of the node
VARIANT nodeValue   NB. value stored in the node
void nodeValue VARIANT    NB. value stored in the node
DOMNodeType nodeType   NB. the node's type
IXMLDOMNode* parentNode   NB. parent of the node
...
   destroy__p''
0