Пример обработки XML на XLINQ

Правильная схема для этого XML будет вот такая. При обработке создается и обрабатывается вот такой XML.


   1:  Imports <xmlns:b="http://AirtsBankingCards.vb-net.com/">
 ....              ...
 115:              'кеширование чтения профиля из базы
 116:              Dim UserPaymentProfile1 As System.Collections.Generic.List(Of GetOneUserPaymentProfileResult)
 117:              If Session("UserPaymentProfile") Is Nothing Then
 118:                  Dim AirtsDB As New UserPaymentProfileDataContext()
 119:                  Dim AirtsDB_MemoryBuf As System.Collections.Generic.List(Of GetOneUserPaymentProfileResult) = AirtsDB.GetOneUserPaymentProfile(New Guid(CheckUser1.id)).ToList
 120:                  Session("UserPaymentProfile") = AirtsDB_MemoryBuf
 121:              End If
 122:              UserPaymentProfile1 = Session("UserPaymentProfile")
 123:              Dim BankingCards_xml As Collections.Generic.IEnumerable(Of XElement) = From AllColumn In UserPaymentProfile1 Select AllColumn.BankingCardsProfile
 124:              '
 125:              If BankingCards_xml(0) IsNot Nothing Then
 126:                  BankingCards_xml(0).<b:VISA>[email protected]:Module = cb_VISA_Module.Text
 127:                  BankingCards_xml(0).<b:VISA>[email protected]:Code = tx_VISA_Code.Text
 128:                  BankingCards_xml(0).<b:VISA>[email protected]:Comission = tx_VISA_Comission.Text
 129:                  BankingCards_xml(0).<b:VISA>[email protected]:DayLimit = tx_VISA_Daylimit.Text
 130:                  BankingCards_xml(0).<b:VISA>[email protected]:MounthLimit = tx_VISA_MounthLimit.Text
 131:                  BankingCards_xml(0).<b:MC>[email protected]:Module = cb_MC_Module.Text
 132:                  BankingCards_xml(0).<b:MC>[email protected]:Code = tx_MC_Code.Text
 133:                  BankingCards_xml(0).<b:MC>[email protected]:Comission = tx_MC_Comission.Text
 134:                  BankingCards_xml(0).<b:MC>[email protected]:DayLimit = tx_MC_Daylimit.Text
 135:                  BankingCards_xml(0).<b:MC>[email protected]:MounthLimit = tx_MC_MounthLimit.Text
 136:                  BankingCards_xml(0).<b:JCB>[email protected]:Module = cb_JCB_Module.Text
 137:                  BankingCards_xml(0).<b:JCB>[email protected]:Code = tx_JCB_Code.Text
 138:                  BankingCards_xml(0).<b:JCB>[email protected]:Comission = tx_JCB_Comission.Text
 139:                  BankingCards_xml(0).<b:JCB>[email protected]:DayLimit = tx_JCB_DayLimit.Text
 140:                  BankingCards_xml(0).<b:JCB>[email protected]:MounthLimit = tx_JCB_MounthLimit.Text
 141:                  BankingCards_xml(0).<b:DCL>[email protected]:Module = cb_DCL_Module.Text
 142:                  BankingCards_xml(0).<b:DCL>[email protected]:Code = tx_DCL_Code.Text
 143:                  BankingCards_xml(0).<b:DCL>[email protected]:Comission = tx_DCL_Comission.Text
 144:                  BankingCards_xml(0).<b:DCL>[email protected]:DayLimit = tx_DCL_DayLimit.Text
 145:                  BankingCards_xml(0).<b:DCL>[email protected]:MounthLimit = tx_DCL_MounthLimit.Text
 146:                  BankingCards_xml(0).<b:AMEX>[email protected]:Module = cb_AMEX_Module.Text
 147:                  BankingCards_xml(0).<b:AMEX>[email protected]:Code = tx_AMEX_Code.Text
 148:                  BankingCards_xml(0).<b:AMEX>[email protected]:Comission = tx_AMEX_Comission.Text
 149:                  BankingCards_xml(0).<b:AMEX>[email protected]:DayLimit = tx_AMEX_DayLimit.Text
 150:                  BankingCards_xml(0).<b:AMEX>[email protected]:MounthLimit = tx_AMEX_MounthLimit.Text
 151:                  '
 152:                  UserPaymentProfile1(0).BankingCardsProfile = BankingCards_xml(0)
 153:                  '
 154:                  Dim AirtsDB1 As New UserPaymentProfileDataContext()
 155:                  AirtsDB1.SaveBankingCardsUserProfile(New Guid(CheckUser1.id), BankingCards_xml(0))
 156:              Else
 157:                  Dim NewXML As New XElement(<b:BankingCards/>)
 158:                  NewXML.Add(<b:VISA/>)
 159:                  NewXML.Add(<b:MC/>)
 160:                  NewXML.Add(<b:JCB/>)
 161:                  NewXML.Add(<b:DCL/>)
 162:                  NewXML.Add(<b:AMEX/>)
 163:                  '
 164:                  NewXML.<b:VISA>[email protected]:Module = cb_VISA_Module.Text
 165:                  NewXML.<b:VISA>[email protected]:Code = tx_VISA_Code.Text
 166:                  NewXML.<b:VISA>[email protected]:Comission = tx_VISA_Comission.Text
 167:                  NewXML.<b:VISA>[email protected]:DayLimit = tx_VISA_Daylimit.Text
 168:                  NewXML.<b:VISA>[email protected]:MounthLimit = tx_VISA_MounthLimit.Text
 169:                  NewXML.<b:MC>[email protected]:Module = cb_MC_Module.Text
 170:                  NewXML.<b:MC>[email protected]:Code = tx_MC_Code.Text
 171:                  NewXML.<b:MC>[email protected]:Comission = tx_MC_Comission.Text
 172:                  NewXML.<b:MC>[email protected]:DayLimit = tx_MC_Daylimit.Text
 173:                  NewXML.<b:MC>[email protected]:MounthLimit = tx_MC_MounthLimit.Text
 174:                  NewXML.<b:JCB>[email protected]:Module = cb_JCB_Module.Text
 175:                  NewXML.<b:JCB>[email protected]:Code = tx_JCB_Code.Text
 176:                  NewXML.<b:JCB>[email protected]:Comission = tx_JCB_Comission.Text
 177:                  NewXML.<b:JCB>[email protected]:DayLimit = tx_JCB_DayLimit.Text
 178:                  NewXML.<b:JCB>[email protected]:MounthLimit = tx_JCB_MounthLimit.Text
 179:                  NewXML.<b:DCL>[email protected]:Module = cb_DCL_Module.Text
 180:                  NewXML.<b:DCL>[email protected]:Code = tx_DCL_Code.Text
 181:                  NewXML.<b:DCL>[email protected]:Comission = tx_DCL_Comission.Text
 182:                  NewXML.<b:DCL>[email protected]:DayLimit = tx_DCL_DayLimit.Text
 183:                  NewXML.<b:DCL>[email protected]:MounthLimit = tx_DCL_MounthLimit.Text
 184:                  NewXML.<b:AMEX>[email protected]:Module = cb_AMEX_Module.Text
 185:                  NewXML.<b:AMEX>[email protected]:Code = tx_AMEX_Code.Text
 186:                  NewXML.<b:AMEX>[email protected]:Comission = tx_AMEX_Comission.Text
 187:                  NewXML.<b:AMEX>[email protected]:DayLimit = tx_AMEX_DayLimit.Text
 188:                  NewXML.<b:AMEX>[email protected]:MounthLimit = tx_AMEX_MounthLimit.Text
 189:                  '
 190:                  UserPaymentProfile1(0).BankingCardsProfile = NewXML
 191:                  '
 192:                  Dim AirtsDB2 As New UserPaymentProfileDataContext()
 193:                  AirtsDB2.SaveBankingCardsUserProfile(New Guid(CheckUser1.id), NewXML)
 194:              End If
 195:              ...


Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21
Link to this page: //www.vb-net.com/Linq/xlinq.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>