contents of an XML file
                
                    cedric                
                
                    Member Posts: 8                
            
                        
            
                    Hi,
when using the XMLDOM object model for handling XML files I receive the error 'text of text string too long for...' when calling the XMLDoc.xml method. I need the complete content of the XML file...
Apparently the BSTR automation datatype is used internally and this can only handle upto 250 chars.
Does anyone has a suggestion how to overcome this problem ?
Thx
                when using the XMLDOM object model for handling XML files I receive the error 'text of text string too long for...' when calling the XMLDoc.xml method. I need the complete content of the XML file...
Apparently the BSTR automation datatype is used internally and this can only handle upto 250 chars.
Does anyone has a suggestion how to overcome this problem ?
Thx
0                
            Comments
- 
            Depends on what you want to do with that text. I usually browse an XML document node by node to get the values, so I've never had to use the entire content.
Have you tried using a BigText datatype?0 - 
            Why not use an XMLPort?0
 - 
            To answer DenSter: I not only want the content but also the structure of the document.
To answer Dennis: we use Navision 3.70 (No XMLPort)
tempVar : Text[1024]
XMLDoc : Automation 'Microsoft XML, v4.0'.DOMDocument
tempVar := XMLDoc.xml // throws the error
but also
MESSAGE(XMLDoc.xml)//it is within the .xml method that the BSTR datatype is used0 - 
            The BSTR is not an internal variable, it is the return value of the MSDOM Object's xml method, and it represents a text variable of unlimited length. You get the error because the Text variable in Navision can only hold 1024 characters, so each time you try to put more in it, it raises an error.
Maybe you could share exactly what you need to do, and we can find a solution for you. I don't believe BigText is a datatype in 3.70, so you may have to find something another approach. Because I don't know what you want to do, I can't make any suggestions.0 - 
            First I want to mention that Im not so sure BSTR is unlimited...
I did a character count on the incoming XML message, with < 250 charactes the XMLDOC.xml method succeeds, with > 250 it fails.
This is what it's for:
XMLDoc.save('c:\temp.xml') -> saves an xml file but WITHOUT the declaration section (<?xml version="1.0" encoding="ISO-8859-1" ?>)
so I started this approach
XMLContents := '<?xml version="1.0" encoding="ISO-8859-1" ?>'+ XMLDoc.xml;
and write the XMLDoc to a file.
BTW: Thanks for helping me out on this...0 - 
            I am absolutely positive that the MSDOM object can hold more than 250 characters. I have programmed a sales order xml import for enormous xml documents, so a limitation to the BSTR return variable should not the problem aruond 250 characters. I am wondering about the variable you are using to catch the text.
I haven't tried creating a declaration node, I am surprised that MSDOM.Save doesn't save it. Have you tried creating a new MSDOM object, write the declaration using the MSDOM object model (Create a new child node or something) and then adding the other MSDOM.RootNode to your new MSDOM object. I'd have to try this myself, so I don't know if that'll help.0 - 
            Daniel,
even the MESSAGE(XMLDoc.xml) statement throw the error. Sure the XML file can contain more than 250 chars but it is the .xml method on the XMLDOM that returns the exception.0 - 
            Hi
If you are creating the XML file, the first thing you must do is that.
Name DataType Subtype Length
XMLNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
XMLProccesingInst Automation 'Microsoft XML, v3.0'.IXMLDOMProcessingInstruction
XMLProccesingInst:=XMLDoc.createProcessingInstruction('xml','version="1.0" encoding="iso-8859-1"');
XMLNode := XMLDoc.appendChild(XMLProccesingInst);
XMLNode:=XMLDoc.createElement('ROOT');
...
If you receive this XML and you must add Processing instruction line before all, why don't use 2 File variable, you add this line in one of them and after you add all the lines copying by the other file ??
By0 - 
            Thanks !
IXMLDOMProcessingInstruction is just what I was looking for !0 - 
            Thanks Saalek, that is very useful information =D>. I knew it was in the object model somewhere, just didn't know exactly which method to use.0
 - 
            Hi
You're welcome :oops: :oops: :oops:
I'm hard working with XML integrating Navision with Web Servers (No User Portal, no Commerce portal,...) only ASP, VBScript and XML Files.
A Strange thing: To trate an XML file with Navision, is not necesary to have the Processing Instruction. You can directly access to the Root Node
By
P.D.: Excuse me if my English isn't very good, but I'm studing English since 2004.0 - 
            Your English is very good, at least I think I understand everything you say
.                        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
 - 323 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
 
