NAV writing blob to xmldom

jwilderjwilder Member Posts: 263
I am using the xmldom automation to create an Item Export. (I have NAV 2009 R2)

My one problem is that I have a blob field with text that is over 1024 characters.

How can you write to a node if you have more than 1024 characters?

xmlnode.text := bigtext unfortunatley does not work. Maybe I could use a variant variable or is there an xmldom command to add text so I could call it multiple times?

Answers

  • geordiegeordie Member Posts: 655
    I think you need to use attributes, as shown in this reply.
  • jwilderjwilder Member Posts: 263
    The data can not be written to an attribute only an element. But based on your post I do see a " NodeText.appendData" which is what I need.

    I can do this:
    Node.Text := first 1024 characters;
    nodetext.appendData(second1024 characters);
    nodetext.appendData(third1024 characters);
    etc...

    The only problem now is I can't figure out how to instantiate the nodetext automation variable. The variable is 'Microsoft XML, v6.0'.IXMLDOMText. It compiles when I do nodetext := node; but I get an error during runtime.

    Anyone know how to instantiate a nodetext variable of type automation ('Microsoft XML, v6.0'.IXMLDOMText)?
  • geordiegeordie Member Posts: 655
    Have you tried in this way?
    xmlTextNode := xmlDoc.createTextNode('');
    

    An alternative way would be to export the data with an xmlport property of the text field to BigText and use the AddText method.
  • jwilderjwilder Member Posts: 263
    Xmlports do totally work with bigtext but unfortunately I have other requirements such as hiding and showing certain elements based on certain conditions.

    Based on your post I was able to get this to work so thanks a lot!

    I ended up with this:
    variables:
    NewNode 'Microsoft XML, v6.0'.IXMLDOMNode
    xmlTextNode 'Microsoft XML, v6.0'.IXMLDOMText
    TextArray - Text1024 Dimensions=2

    xmlTextNode := XMLDoc.createTextNode(TextArray[1]);
    NewNode.appendChild(xmlTextNode);
    xmlTextNode.appendData(TextArray[2]);

    This is just a snipet and does include creation of xmldoc and elements. Newnode was already instantiated so you don't see that here. TextArray[1] has 1024 characters of data in it as does TextArray[2].
  • geordiegeordie Member Posts: 655
    Glad it helped.

    Can you mark the topic as solved?
Sign In or Register to comment.