Using XMLDom inside Navision

BackiBacki Member Posts: 5
Hello All,
I have to read a XML Document and change in a Tag the Text Entry.
I 1st though, that this is no problem.
But every time I try I have a error, that the Automation has not Instantiated. (I think it is the XMLNodeCurr)
How the hell ](*,) can I do this?
I saw some non Navision code, they just say "Set XMLNodeCurr" and then it works.

It would be great If someone has me a hint for this. [-o<

Yours
Stephan

FullPath := 'C:\pdf\income\trans.xml';
CREATE(DOMDOC);
DOMDOC.load(FullPath);

IF DOMDOC.parseError.errorCode <> 0 THEN
  ERROR('XML DOM Error: %1',DOMDOC.parseError.reason);

XMLNodeCurr := DOMDOC.selectSingleNode('/signOnRq/DtClient');  
????

XMLNodeCurr.text := FORMAT(TODAY,0,'<Year4>-<Month,2>-<day,2>') + 'T' + FORMAT(TIME,0,1) + 'Z'

DOMDOC.save(FullPath);
CLEAR(DOMDOC);
Yours
Stephan

Comments

  • pduckpduck Member Posts: 147
    put a IF ISCLEAR(XMLNodeCurr) THEN ERROR('not found'); after XMLNodeCurr := DOMDOC.selectSingleNode('/signOnRq/DtClient'); and you will see if the node was found or not
  • BackiBacki Member Posts: 5
    pduck wrote:
    put a IF ISCLEAR(XMLNodeCurr) THEN ERROR('not found'); after XMLNodeCurr := DOMDOC.selectSingleNode('/signOnRq/DtClient'); and you will see if the node was found or not

    Yeah thats it.. NOT FOUND!!
    XMLNodeCurr := DOMDOC.selectSingleNode('//SignOnRq/DtClient');
    IF ISCLEAR(XMLNodeCurr) THEN 
      ERROR('not found');
    

    2 Errors in the Search String.
    Now it works!
    THANK YOU very mutch \:D/
    Yours
    Stephan
Sign In or Register to comment.