How to access xml child value

cunnycunny Member Posts: 129
I know this might not be the right place to post it,

But I really got stuck after a lot of test in codeunit 8611 "Migration Management". There is a function called "ImportSetupDataXML" which is using "TableNode.firstChild.text" to retrieve TableID from the xml file. I tried to use something similar to retrieve the MigrationID but it did not work. The xml document is showing in the picture. How to get the MigrationID child value "10000".

Thanks a lot,
cunny Lee
MCP - MBS Navision
jle@naviworld.com
1.png 8.8K

Answers

  • garakgarak Member Posts: 3,263
    check also Codeunit 6224 and the other CU with @*xml* in the name
    Do you make it right, it works too!
  • ta5ta5 Member Posts: 1,164
    Do you want to open this file using MSXMLDOM-Automation Object?
    Regards
    Thomas
  • cunnycunny Member Posts: 129
    Thanks guys,

    I added the code lines below into codeunit 8611 function "ImportSetupDataXML" and now it works.
    IF EVALUATE(TableID,FORMAT(TableNode.firstChild.text)) THEN;
      // +
      MigrationIDNode := TableNode.selectSingleNode(GetElementName(MigrationTable.FIELDNAME(MigrationID)));
      IF NOT ISCLEAR(MigrationIDNode) THEN
        IF EVALUATE(MigrationID, MigrationIDNode.text) THEN;
      // -
      IF (TableID <> 0) AND (NOT MigrationTable.GET(TableID, MigrationID)) THEN BEGIN
    

    So TableNode.selectSingleNode did the trick :wink:

    Thanks again and have a nice weekend,
    cunny Lee
    MCP - MBS Navision
    jle@naviworld.com
Sign In or Register to comment.