how to read long text in XML node
scott
Member Posts: 76
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
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
-
Please search this forum before posting a question - it has been answered several times before.
BTW, check out the IXMLDOMCharacterData interface.
Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
I searched both the forum and website on IXMLDOMCharacterData. Still did not find good answer.
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
Scott0 -
search in the forum: *xmldom*0
-
Try "BSTR that exceeds string buffer length" 17/08/20060
-
Thanks. "BSTR that exceeds string buffer length" 17/08/2006 does have a useful solution.
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 Function0 -
thansk for everyone's help.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
