I currently have some requirements for an integration that I am doing and was curious if anyone had some feedback on the best initial approach. I am currently working on building out the structure using the Dom Document method for generating the file but I am looking for some guidance on the most expandable direction. They use the ACORD standard for interpreting XML documents.
I definitely see that I can use custom settings to essentially build out the structure making it changeable from an admin or someone else who is technically inclined but I am not convinced it is completely necessary.
The document I am making is very large and has some repeatable sections in it. Currently, I am making data members in a controller to populate the values of the various elements. The larger elements have their own methods to encapsulate the fields required to build them but essentially one method will construct the entire string based on populated values (data members). Obviously this can be bad if XML tags change and the order changed and this would be better to correct if it was all contained in a custom setting but are there any other things that I could potentially hit following this approach?
Example code below:
Dom.XMLnode parentNode= rootNode.addChildElement('ParentNodeName',null,null);
createComplexElement(parentNode);
parentNode.addChildElement('SimpleElement1',null,null).addTextNode(this.SimpleElement1Text);
parentNode.addChildElement('SimpleElement2',null,null).addTextNode(this.SimpleElement2Text);
createADifferentComplexElement(parentNode);
The code above is getting larger as the sample XML document I have has over 200 lines of tags. The size of the file can be variable based on various conditions that could make it much larger depending on how many repeatable section there are for any given scenario.
I still need to verify with the 3rd party system if I need to worry about XML tags being changed or modified but I feel like I should handle this situation anyways.
If anyone has some experience dealing with creating large XML documents - any information you can discuss on what you hit down the road and possible suggestions to avoid that scenario would be greatly appreciated!
Thank you.
If the question is too ambiguous - I can refine it.