XMLDom Attribute long value

BeagleBeagle Member Posts: 8
Hi,

I try to export our Items in a xml File and I use for this the XMLDom automation. Unfortunately we have some Attributes which are longer than 1024 signs. I get the error Message:" The length of the text string exceeds the size of the string buffer"
In the Forum I found an solution how I can assign long values to Elements( viewtopic.php?f=23&t=30549&hilit=xml) . The question is now it's possible to assign a long value to an Attribute which is longer than 1024.

Regards Dominik

Comments

  • ara3nara3n Member Posts: 9,256
    No it's not possible. It's one of those very annoying limitation in Nav. In fact I'm stuck in same senario with passing SQL Statemtn to ADO. the sql statement is larger than 1024 characters.
    You can use xmlport instead of MSDOM

    It's basically a show stopper for me.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jlandeenjlandeen Member Posts: 524
    I don't think there is any way in Navision to assign a value that exceeds 1024 to a variable in Navision. About the only way I can think of tackling that type of scenario is to use a BLOB object and then stream in/out of it in chunks.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    It might not be the answer you are looking for - but if you are running on the Service Tier in NAV 2009 (meaning either RTC or Web Services) - you are running C# code (as you know) in which both Text and BigText are transferred as strings when transferred to COM objects

    Described in

    http://blogs.msdn.com/freddyk/archive/2008/11/04/transferring-data-to-from-com-automation-objects-and-webservices.aspx

    I think the XMLAttribute value is an object - in which case it actually should work (I haven't tried) to transfer a BigText directly to that.

    Note though - that the code will NOT work in the Classic Client - nor on the NAS - so it might not be what you are looking for...
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • niscoxniscox Member Posts: 15
    Hi,
    the IXMLDOMText interface works also with attributes.
    for example:
    CREATE(msXmlDomDocument);
    
    msXmlDomProcessingInstructions := msXmlDomDocument.createProcessingInstruction('xml', 'version="1.0" encoding="cp850"');
    msXmlDomDocument.appendChild(msXmlDomProcessingInstructions);
    
    msXmlDomElement := msXmlDomDocument.createElement('root');
    msXmlDomElement.setAttribute('atName', '');
    
    msXmlDomText := msXmlDomElement.selectSingleNode('@atName').firstChild;
    
    FOR i := 1 TO 1025 DO
      msXmlDomText.appendData('a');
    
    msXmlDomDocument.appendChild(msXmlDomElement);
    
    msXmlDomDocument.save('C:\test.xml');
    
  • jlandeenjlandeen Member Posts: 524
    Thats an excellent example - thanks for posting. I've used the XML Dom objects to move and find data in the XML tree, but I hadn't used that particular object.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.