Hello ALl,
Somthing weird is happening and i can't seem to see why. I have an XpathNodeIterator and it gives me back 2 nodes but continuously loops and won't stop. It should only loop twice but it's stuck in an infinite loop. anyone know why this might be happening? Here is the code.
for ( int i = 0; i < cloneD.NumberClones; i++ )
{
//create the new cloned row
string newIdNumber = Guid.NewGuid( ).ToString( );
XPathNavigator newRow = formControl1.XmlForm.MainDataSource.CreateNavigator( ).SelectSingleNode( Constants.ASSET_INSTANCE_ID + "[text()='" + identifier + "'" + "]", xmlnsm );
newRow.MoveToParent( );
newRow.InsertAfter( newRow.OuterXml );
newRow.SelectSingleNode( "./my:ass_InstanceID", xmlnsm ).SetValue( newIdNumber );
//create the new attachment row if there are any attachments
XPathNodeIterator attIterator = formControl1.XmlForm.MainDataSource.CreateNavigator( ).Select( Constants.ATTACHMENT_ASSET_INSTANCE + "[text()='" + identifier + "'" + "]", xmlnsm );
while ( attIterator.MoveNext( ) ) <== this is where the infinite loop is occurring
{
attIterator.Current.MoveToParent( );
attIterator.Current.InsertAfter( attIterator.Current.OuterXml );
attIterator.Current.SelectSingleNode( Constants.ATTACHMENT_SURVEY_ITEM, xmlnsm ).SetValue( newIdNumber );
}
}