Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Xml coding
Message
De
03/10/2007 09:14:13
 
 
À
03/10/2007 03:40:43
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Divers
Thread ID:
01258107
Message ID:
01258185
Vues:
13
Hi Viv,

Thanks for the suggestion. I took out this line and it is still the same. Please help.

Thanks,
Sam

>Hi,
>'oActivities.RemoveChild(oActivity)' is probably messing up the iteration. Does the table get populated correctly if you remove that line ?
>Regards,
>Viv
>
>
>>I am trying to loop through my XML file to get the details, but somehow, I don't get all the data I needed. Here is the tree of my XML file:
>>
>>
>><activity_summary>
>>  <level_plan>
>>    <level_segment level_key="1243">
>>      <activities>
>>        <activity act_key="1" ... no_action="Y">
>>          <detail det_key="8" data1="0" data2="0" data3="0">
>>          <detail det_key="12" data1="0" data2="0" data3="0">
>>          <detail det_key="16" data1="0" data2="0" data3="0">
>>          <detail det_key="24" data1="0" data2="0" data3="0">
>>        </activity>
>>      </activities>
>>    </level_segment>
>>    <level_segment level_key="4243">
>>      <activities>
>>        <activity act_key="1" ... no_action="N">
>>          <detail det_key="8" data1="10" data2="20" data3="30">
>>          <detail det_key="12" data1="10" data2="20" data3="30">
>>          <detail det_key="16" data1="10" data2="20" data3="30">
>>          <detail det_key="24" data1="10" data2="20" data3="30">
>>        </activity>
>>      </activities>
>>    </level_segment>
>>  </level_plan>
>></activity_summary>
>>
>>
>>Here is my code:
>>
>>        Dim oActivities As System.Xml.XmlElement
>>        Dim oActivityNodeList As System.Xml.XmlNodeList
>>        Dim oActivitiesNodeList As System.Xml.XmlNodeList
>>        Dim oActivity As System.Xml.XmlElement
>>
>>        Dim dcol As System.Data.DataColumn
>>        Dim drAsset As System.Data.DataRow
>>
>>        ' Table to hold segments
>>        Dim dtSegments As New System.Data.DataTable("seg_assets")
>>        dcol = New System.Data.DataColumn("act_key", System.Type.GetType("System.Int32"))
>>        dtSegments.Columns.Add(dcol)
>>
>>        xmlDoc.LoadXml(strActivityXml)
>>
>>       If m_ReportXml.GetElementText("/report/reportcontent//control/show_all_segments") = "Y" Then
>>	bShowAllSegments = True
>>       End If
>>			
>>
>>       oActivitiesNodeList = xmlDoc.DocumentElement.SelectNodes("//level_plan/level_segment/activities")
>>
>>For Each oActivities In oActivitiesNodeList
>>        For Each oActivity In  oActivities.childnodes
>>            If Not bShowAllSegments And oActivity.GetAttribute("no_action") = "Y" Then
>>                oActivities.RemoveChild(oActivity)
>>            Else
>>                Dim bAstFound As Boolean
>>                'Dim drAsset As System.Data.DataRow
>>                For Each drAsset In dtSegments.Rows
>>                        If drAsset.Item("act_key") = oActivity.GetAttribute("act_key") Then
>>                            bAstFound = True
>>                        End If
>>                Next
>>                If Not bAstFound Then
>>                        'Dim drAsset As System.Data.DataRow
>>                        drAsset = dtSegments.NewRow
>>                        drAsset.Item("act_key") = oActivity.GetAttribute("act_key")
>>                        dtSegments.Rows.Add(drAsset)
>>                        iSegmentsToDisplayCount = iSegmentsToDisplayCount + 1
>>                End If
>>            End If
>>        Next
>>Next
>>
>>
>>Please help.
>>
>>Thanks,
>>Sam
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform