I got an error "the length of text string exceeds the size of the string buffer" when executing this:
textvariable := XMLNode.attributes.getNamedItem('Note').text
I guess we can assign the node value to instream. But not sure the correct syntex.
Does anyone have any idea?
Thanks.
Scott
0
Comments
BTW, check out the IXMLDOMCharacterData interface.
Jan Hoek
Product Developer
Mprise Products B.V.
In the attribute of a node, there can be a few thousand characters. We need to get all characters, not just first 250.
Do you have any sample codes?
Thanks
Scott
For some reasons, 'Navision Attain Hash 1.0'.BSTRConverter deletes line return characters, so output is not very clean...
I wrote a VB 6 dll program to take care of this. You can specify maximum characters per line. It cuts notes between words, and retains line return characters.
Codes in Navision...
HeaderNoteFileName := FileRec.Path + '\Note\' + FileRec.Name + '.TXT';
IF MYDLL.DownloadNote(XMLNode.attributes.getNamedItem('Note').nodeValue,HeaderNoteFileName,MaxCharacterPerLine) = 'OK'
THEN BEGIN
HeaderFile.OPEN(HeaderNoteFileName);
HeaderFile.TEXTMODE := TRUE;
ReadOK := TRUE;
HeaderCommentLineNo := 0;
WHILE ReadOK DO BEGIN
IF HeaderFile.READ(MessageLine) <> 0 THEN BEGIN
HeaderCommentLineNo += 10000;
TempSalesCommentLine.INIT;
TempSalesCommentLine."Document Type" := TempSalesCommentLine."Document Type"::Quote;
TempSalesCommentLine."No." := TempSalesHeader."No.";
TempSalesCommentLine."Line No." := HeaderCommentLineNo;
TempSalesCommentLine.Date := WORKDATE;
TempSalesCommentLine.Comment := MessageLine;
TempSalesCommentLine.INSERT;
END ELSE
ReadOK := FALSE;
END;
END;
Codes in VB 6...
Public Function DownloadNote(ByVal NoteMessage As Variant, ByVal FileName As String, ByVal MaxCharacters As Integer) As String
On Error GoTo errorHandler
Dim String1 As String
Dim x As Integer
If NoteMessage = "" Then
Exit Function
End If
Open FileName For Output As #1
Do Until NoteMessage = ""
String1 = Left$(NoteMessage, MaxCharacters)
For x = 1 To Len(String1)
If InStr(Right$(String1, x), " ") <> 0 Then
Exit For
End If
Next x
String1 = Left$(String1, MaxCharacters - x)
NoteMessage = Mid(NoteMessage, MaxCharacters - x + 2):
Print #1, String1
Loop
Close 1
DownloadNote = "OK"
Exit Function
errorHandler:
Err.Raise -12345678, "HttpPost", Err.Description
End Function