About IXMLDomNode automation

TerTer Member Posts: 2
Hello,
i read the post about it, but it did'nt helped me, maybe i understood it bad. I try to write me a automation, that i call it and i send a IXMLDomNode to it, there i make changes and send it back to NAV. But when i try to call the function i get a error:
Could not invoke the member XML3.... Unknown error.

The code is:


CREATE(XMLDoc);
XMLDoc.async(FALSE);
CREATE(test);

DOMNode := XMLDoc.createNode(1,'NewNode','');
XMLDoc.appendChild(DOMNode);
DomTextNode := XMLDoc.createTextNode('node1');
DOMNode.appendChild(DomTextNode);
DomNode := test.XML3('TEST', DomNode);
MESSAGE(DomNode.text);

The globals are:
XMLDoc : DomDocument60
DomNode : IXMLDomNode
DomTextNode : IXMLDomText
test : my Automation
t : Text

And the function from my Automation is:
public IXMLDOMNode XML3(String text, IXMLDOMNode nodes)
{
nodes.text = text;
return nodes;

}

If i try to send text to automation and back it works, but no IXMLDomNode :(

Maybe someone has a tips or idea or the solution for it?

Comments

  • sergisoftsergisoft Member Posts: 37
    You need to create a XML Root Element. All nodes you are creating are contained nowhere.

    Example:
    WITH XMLDOMManagement DO BEGIN
      XMLDocOut.loadXML := '<ROOT/>';
      XMLCurrNode := XMLDocOut.documentElement;
      IF AddElement( XMLCurrNode, 'PROCESS_TYPE', ProcessType, DocNameSpace, XMLNewChild) > 0 THEN EXIT;
      IF AddElement( XMLCurrNode, 'GUID', GUID, DocNameSpace, XMLNewChild) > 0 THEN EXIT;
    END;
    

    Sergi Navarro

    MCTS: Microsoft Dynamics™ NAV 2009 C/SIDE Solution Development

    Visit my Navision Spanish Blog here: http://www.sergisoft.com
Sign In or Register to comment.