Accessing ErrorCollection Object

R

Rama

Hi All,

I need to filter through the XDocument ErrorCollection Object to access the
errors corresponding to my current node. This is my code where I am looping
through my current node attribute collection and checking to see if the
corresponding node exists in the XDocument error collection object.

Dim childNode As IXMLDOMNode
Dim errObject As Microsoft.Office.Interop.InfoPath.SemiTrust.ErrorObject
Dim getTextBuilder As StringBuilder = New StringBuilder

getTextBuilder.Append("<table>")
For each childNode in node.attributes 'node ~ Current Node
For Each errObject In xDoc.Errors
If childNode Is errObject Then
getTextBuilder.Append("<tr><td>" &
errObject.Node.nodeName & ": " & errObject.ShortErrorMessage & "</td></tr>")
End If
Next
Next

getTextBuilder.Append("</table>")

This approach is not giving me the correct results. To add to this, every
time I run this piece of code (without making any changes in my Form
elements), I get a different result. The Error Collection count remains
unchanged though.
I need a way to filter the errors so that I can display them in the right
context. Is there a different approach to this problem ? Any help would be
appreciated.
 
Top