Home AMX User Forum NetLinx Studio

Structured arrays and XML

I have a structured array that I am trying to load with data. I would have no problem just loading it through NS debugger, but when I press enter after entering new data, it comes up with an error message saying "the variable you have modified is too large to be sent back to the master. existing netlinx firmware does not support multiple packets."

It is an NI 2100 with the latest firmware.

My next step was saving the array to an XML file, which worked. I then used XML Pad and put a few things in it. I then replaced the original file on the master and tried reloading it. When I activate the reload code using a button event, it comes up with a couple errors in the diagnostics.

Line 1 :: CIpLibrary::CopyXmlToItem Error -2 - 22:57:31
Line 2 :: CIpLibrary::Xml_To_Variable - Error -2 - 22:57:31

What could be causing that?

Thanks,
Ryan

Comments

  • viningvining Posts: 4,368
    ryanww wrote:
    I have a structured array that I am trying to load with data. I would have no problem just loading it through NS debugger, but when I press enter after entering new data, it comes up with an error message saying "the variable you have modified is too large to be sent back to the master. existing netlinx firmware does not support multiple packets."
    Yep, you can change values of integers and possibly a short string that's only a few chars long, maybe. Brains a little fuzzy and I don't recall but strings of length, no way.


    You can insert the following into your code for debugging the returns of the VARIABLE_TO_XML and XML_TO_VARIABLE

    VARIABLE_TO_XML:
    nEncodePOS = 1 ;
    	  nVAR_to_XML_Encode = VARIABLE_TO_XML(sStructure,cVar_to_XML_Buffer,nEncodePOS,0 ) ;
    	  if (nDeBug)
    	       {
    	       switch (itoa(nVar_to_XML_Encode))
    		    {
    		    case '-1': {cXML_MSG = 'ERROR -1 = decode variable type mismatch' } ;
    		    case '-2': {cXML_MSG = 'ERROR -2 = decode data too small, decoder ran out of data. Most likely poorly formed XML.' } ;
    		    case '-3': {cXML_MSG = 'ERROR -3 = output character buffer was too small' } ;
    		    case '3' : {cXML_MSG = 'ERROR  3 = XML decode data type mismatch' } ;
    		    case '2' : {cXML_MSG = 'ERROR  2 = XML decode data too small, more members in structure' } ;
    		    case '1' : {cXML_MSG = 'ERROR  1 = structure too small, more members in XML decode string' } ;
    		    case '0' : {cXML_MSG = 'Returned 0 = decoded OK! ' } ;
    		    }
    	       SEND_STRING 0,"'MODULE_NAME: XML Encoding: ',cXML_MSG,' Line-<',ITOA(__LINE__),'>',crlf" ;
    	       }
    				   
    
    XML_TO_VARIABLE:
    	  nPOS = 1 ;
    	  nXML_Decode_Return = XML_TO_VARIABLE (sStructure,cVar_to_XML_Buffer,nPOS,0) ;
    	  if (nDeBug)
    	       {
    	       switch (itoa(nXML_Decode_Return))
    		    {
    		    case '-1': {cXML_MSG = 'ERROR -1 = decode variable type mismatch' } ;
    		    case '-2': {cXML_MSG = 'ERROR -2 = decode data too small, decoder ran out of data. Most likely poorly formed XML.' } ;
    		    case '-3': {cXML_MSG = 'ERROR -3 = output character buffer was too small' } ;
    		    case '3' : {cXML_MSG = 'ERROR  3 = XML decode data type mismatch' } ;
    		    case '2' : {cXML_MSG = 'ERROR  2 = XML decode data too small, more members in structure' } ;
    		    case '1' : {cXML_MSG = 'ERROR  1 = structure too small, more members in XML decode string' } ;
    		    case '0' : {cXML_MSG = 'Returned 0 = decoded OK! ' } ;
    		    }
    	       SEND_STRING 0,"'MODULE_NAME: XML Decoding: ',cXML_MSG,' Line-<',ITOA(__LINE__),'>',crlf" ;
    	       }
    
  • ryanwwryanww Posts: 196
    Got it.. I guess something with XMLPad doesn't work. When I would modify the file using that then loading it, it would give the error. It was also a kb or so smaller then the original. I am using Petes XML editor now and it works fine.

    Thanks,
    Ryan
Sign In or Register to comment.