Hi All,
I am retrieving an XML document from a web service (which works fine). The XML doc looks something like this:

In NAV, I am using 'Microsoft XML, v6.0'.DOMDocument to retrieve it and save it to disk. So far so good.
What I have to do, however, is access the various elements within <transaction> to create an order in NAV. I cannot for the live of me make that work. Stuff like "SelectSingleNode" fails. So I tried to somehow read the content (or rather the value) of the <transaction> element into a new DOM in order to be able to navigate and process it. I have tried many ways to do it and it all errors out with "The length of the text exceeds the length of the string buffer" - since NAV (still) is limited to 1024 characters for string variables.
So I did:
Node := XMLDoc.selectSingleNode('Envelope/Body/GetTransactionResponse/transaction');
which actually works. But then I do this:
XMLDoc.load(Node.xml);
or
XMLDoc.loadXML(Node.text);
or
XMLDoc.loadXML(Node.nodeValue);
or any combination of the above. It all fails due to the string length limitation.
Any idea how I could solve the problem?
Comments
You need to use
IXMLDOMText interface works also with attributes.
Remove the <![CData[ and read the reason into a stream.
Use another xmldom document to load from the new stream.
Then you can use selectSingleNode('Widextransaction/transactiondate'); to extract specific nodes.
The Cdata element makes it basically free form data and anything can be put in it. So the DOM cannot parse it but stores it in nodetext. That's why you need to extract it and put into another DOM document sins it's valid xml data.
As far as COM interface limitation. It's a painfully limitation that I'm running constantly against in every other integration.
MS Please increase it in the next SP1. !!!!!!!!!!!!!!!!!!!!! [-o<
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
This sounds so easy but I still can't get it.
Not like this:
msXmlDomText.CREATEINSTREAM(TestStream);
Could you give me a simple example how to read text into a stream?
Try to use a sample xml file from msdn or w3c schools and test your code against this "clean" files. If everything works allright you can get back to the real file.
I know this is the slow way, but you get more insights of the problem.
Btw: Can you get the Text from "GetTransactionResult"?
Hope this helps
Thomas
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n