XML DOMNode.Text

ta5
Member Posts: 1,164
Hi
I have a strange issue with the xml domnode.text, if the text is very long (> 250?).
Both of the 2 ffw. code snippets produce the error "The length of the text string exceeds the size of the string buffer". NewValue is a string with the maxlength of 250.
1)
NewValue := COPYSTR(DOMNode.text,1,250);
2)
DOMNodeText.data := DOMNode.text; //error happens here
NewValue := DOMNodeText.substringData(1,250);
Any ideas? Thank you in advance
Thomas
PS: I hope I didn't post twice, because there was an error with the internet connection when I wanted to post 1 hour ago...
I have a strange issue with the xml domnode.text, if the text is very long (> 250?).
Both of the 2 ffw. code snippets produce the error "The length of the text string exceeds the size of the string buffer". NewValue is a string with the maxlength of 250.
1)
NewValue := COPYSTR(DOMNode.text,1,250);
2)
DOMNodeText.data := DOMNode.text; //error happens here
NewValue := DOMNodeText.substringData(1,250);
Any ideas? Thank you in advance
Thomas
PS: I hope I didn't post twice, because there was an error with the internet connection when I wanted to post 1 hour ago...
0
Comments
-
Hi
Still having the same problem, maybe it's how Navision handles automation objects, see
http://www.mibuso.com/forum/viewtopic.php?t=7980
Any ideas/comments will be appreciated.
Many thanks in advance.
Thomas0 -
You almost had it in your example 2 --
The text of a DOMNode is an object of type IXMLDOMText. You can get at it like this:DOMText := DOMNode.firstChild; NewValue := DOMText.substringData(1,250);
0 -
Hi
Thank you for your info. So far it works now.
CREATE(XMLDom);
XMLDom.async := FALSE;
XMLDom.load('c:\books.xml');
DOMElement := XMLDom.documentElement;
DOMNode := DOMElement.selectSingleNode('//book/description');
// this works
DOMNodeText := DOMNode.firstChild;
// this produces a compile error "an assigment is not allowed for this //variable
DOMNodeText := DOMNode.text;
NewValue := DOMNodeText.substringData(1,250);
Anyway, I'm not so happy with the firstchild property. Is there no way to use the text property?
Thanks in advance
Thomas0 -
Assuming that your DOMNode variable is a 'Microsoft XML, v3.0'.IXMLDOMNode object, the Text property should be accessible. It works for me in a number of XML codeunits.0
-
Hi DanielDenSter wrote:Assuming that your DOMNode variable is a 'Microsoft XML, v3.0'.IXMLDOMNode object, the Text property should be accessible. It works for me in a number of XML codeunits.
Does this work for you with Text longer than 250 too? If yes, can you post the code snippet?
To precise my last posting: For me it seems more consequent to use the text-property of a node, rather than use the firstchild-property. However, firstchild works with long text, text doesn't. :?
Any comments to that?
Thomas0
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
- 320 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