Hi everyone,
I'm trying to send a xml file content to a MSMQ that will be read by a C# application. The NAV code set a Item record filter by "Service Item Group" and than use u XMLPort to get the data generated. For now, i've simplified the code just to print the xml content, and i'm getting this error:
The length of the text string exceeds the size of the string buffer when i try to print it (MESSAGE), and the same ocurrs when i try to send the content to a MSMQ
Here's the code:
CREATE(XMLDom);
Item.SETFILTER ("Service Item Group",'ACESSDIV');
TestFile.CREATE('C:\XML_Item.xml');
TestFile.CREATEOUTSTREAM(TestStream);
XMLPORT.EXPORT(123456701,TestStream,Item); //Use any codeunit for test porpose folks...
TestFile.CLOSE;
XMLDom.load('C:\XML_Item.xml');
MESSAGE(XMLDom.xml); // *** HERE'S OCCUR THE ERROR ***
CLEAR(XMLDom);CLEAR(Item);Automation Variables:
XMLDom Automation 'Microsoft XML, v6.0'.DOMDocument
Item Record Item
TestFile File
TestStream OutStream
Can anyone solve this error?
Nunca discutas com um idiota em público...podem não distinguir quem é quem...
Comments
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
The problem happens if you try to store a string value lager than the specific string value.
For example if you try to save a customer name larger than 30 chars and Navision by default only stores 30 chars
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
If you are using automation can you show me a sample of you code?
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
Here is a piece of my code. The loop basically starts at the 'WHILE DO' line. I copied this more or less from a standard Navision function in CodeUnit 6226, function 'Sales'.
WITH XMLDOMManagement DO BEGIN
XMLNode := XMLDocIn.documentElement;
DataLineArea := '/po:ProcessPurchaseOrder/po:DataArea/po:PurchaseOrder/po:Line/po:';
IF FindNodes(XMLNode,DataLineArea+'Line',XMLNodeList) THEN BEGIN //to find PO-Line node
//XMLNodeList.reset();
//XMLNode:= XMLNodeList.nextNode();
WHILE NOT ISCLEAR(XMLNode) DO BEGIN //not looping. Need to fix that.
IF FindNode(XMLNode,DataLineArea+'OrderItem/po:Description',XMLNodeFound) THEN
IF STRLEN(XMLNodeFound.text) > 0 THEN
EVALUATE(SheetLine.Description,XMLNodeFound.text);
.
.
.
XMLNode:= XMLNodeList.nextNode();
END;
END;
END;
The code is working but only for the first SalesLine Node. The next SalesLineNode is not being read.
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
RIS Plus, LLC
Is this the solution for my salesline next read problem in a DOM? I'm confused.
If so, can you explain how it works?
FindNodes return all the lines.
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
It looks like I have a problem with the XMLNodeList. For some reason it doesn't return an node list although it finds the first salesLine node in the XML file.