Options

XML: How to import >1024 chars

rozemarozema Member Posts: 15
edited 2014-12-11 in NAV Three Tier
Hello all,

Could/would someone help? (Checked out Mibuso before posting this but could not find the solution or make it work)
My issue: I need to import xml file with a field > 1024 Characters. (in this example code import the calendar data from outlook).
I do not want to use xml port but use the automation variables.
I receive the error "the length of the text string exceeds the size of the string buffer".
I tried to use other XML automation type (eg 'Microsoft XML, v6.0'.IXMLDOMText), but I could not get it working:

Anyone knows how to fix this (and want to share)? Much appreciated!!!!!

IF ISCLEAR(XMLDocument) THEN CREATE(XMLDocument);
XMLDocument.load('x:\tmp\Calendar.xml');
XMLNodeList := XMLDocument.getElementsByTagName('Calendar');
XMLNode := XMLNodeList.item(0);
BEGIN
REPEAT
i := i + 1;
Cal_Rec.INIT;
Cal_Rec."No." := i;
Cal_Rec.Subject := XMLNode.selectNodes('Subject').item(0).text;
EVALUATE(Cal_Rec.StartDate,XMLNode.selectNodes('StartDate').item(0).text);
Cal_Rec.MeetingOrganizer := XMLNode.selectNodes('MeetingOrganizer').item(0).text;
Cal_Rec.Categories := XMLNode.selectNodes('Categories').item(0).text;

// CODE LINE BELOW IS THE PROBLEM...
Cal_Rec.Description := copystr(XMLNode.selectNodes('Description').item(0).text,1,250);
//

Cal_Rec.INSERT;
XMLNode := XMLNodeList.nextNode;
UNTIL ((ISCLEAR(XMLNode)) OR (i = 10));
END;

Kind regards, Peter

Comments

  • Options
    BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    Sounds like you are running on NAV2009 as NAV2013 and forward can handle unlimited strings.
    Anways; Last time I had the same problem (in XBRL in NAV5) I wrote the xml node to a BLOB, and then read it back one piece at the time. That way you can copy or split the description. But it is a bit cumbersome.
    Bardur Knudsen
    Microsoft - Dynamics NAV
Sign In or Register to comment.