I have an InfoPath form that pulls some records from a database and displays them on the form. This is all done in code behind. The way I populate the nodes is to use the .NET StringBuilder object to construct the XML string, which may contain 20 or so base nodes, and each of those containing their own elements/nodes. The entire tree averages a couple of hundred elements/nodes in total.
After building the string, I use XPATHNavigator.AppendChild() to insert the nodes into my form. Problem is InfoPath's node parsing performance is terrible. A typical time taken for each part is around about:
- Connect to Database and retreive data set: 30ms
- Use StringBuilder to construct XML nodes: 0ms (Too fast to measure)
- Calling XPATHNavigator.AppendChild(): 4000ms
Now it shouldn't be taking this long, so I'm wondering if you guys know any techniques to create nodes in the form faster. I assumed that building the XML string manually and then calling AppendChild() only once would speed things up, but apparently it has not.