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
0
Comments
Have you tried using a BigText datatype?
RIS Plus, LLC
MVP - Business Apps
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 used
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.
RIS Plus, LLC
MVP - Business Apps
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...
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.
RIS Plus, LLC
MVP - Business Apps
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.
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 ??
By
IXMLDOMProcessingInstruction is just what I was looking for !
RIS Plus, LLC
MVP - Business Apps
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.
RIS Plus, LLC
MVP - Business Apps