I have an XMLPort. Before it is outputted to a file and/or stream, I want to modify some node names. Is there a trigger that gives me access to the actual XML node?
Specific use case is, I'm trying to create an XMLPort where there is a node called <action> . I've tried to set the Node Name to action (Node Type element, Source Type text), but it will not let me do that because "action" is a reserved word. (ACTION.ok, etc).
0
Answers
So use Node Name 'action' and just rename the 'Data Source' (probably now is '<action>') into something else.
The Node is type Element of Text, so there isn't a Data Source field. The Data Source becomes the Node Name, which is "action". So you're right, that would work for the case when the Data Source = Record."Action".
So far, I've been working on a solution where, after the XMLPort is done, it will iterate through the document, find elements named action_1, and rename them to action. It's based partially on the "skip empty node" thread from this forum. I will post the final solution once it is tested.
http://forum.mibuso.com/discussion/18042/xmlport-skip-empty-tags
Call it by getting the root of your XML document with .documentElement, and call RenameElements(rootnode, 'old_element_name', 'new_element_name')
Well, at least I learned a bunch about DOM manipulation in C/AL code.