解析xml的log表

dim dt_temp as datatable=db_query(sql).tables(0)
for i=0 to dt_temp.rows.count-1
     dim is_exsit as boolean=false
     dim row as datarow=dt.newrow()
     try
        dim document_out as xmldocument=new xmldocument
        dim document_in as xmldocument=new xmldocument
        document_out.loadxml(dt_temp.rows(i)("outxml").tostring())
        document_in.loadxml(dt_temp.rows(i)("inxml").tostring())
        dim node_code as xmlnode=document_out.selectsinglenode("response/excution/status")
        dim node_field as xmlnode=document_in.selectsinglenode("response/excution/status")
       
        if dt_temp.rows(i)("result")="fail" then
           if dt_temp.rows(i)("outxml")="true"then
              continue for
           end if
           dim node_result as xmlnode=document_out.selectsinglenode("response/result")
           if isnothing(node_result)=false then
              if node_result.innertext = "success" then
                 continue for
              end if
           end if
         end if
        
         if isnothing(node_field)=false then
             row("no")=node_field.attributes("value").innertext
         else
             row("no")=dt_temp.rows(i)("keyvalue")
         end if
         if isnothing(node_code)=false then
            row("errorcode")=node_code.attributes("code").innertext
            if row("errorcode").tostring()="-268" then
              continue for
            end if
            row("description")=node_code.attributes("description").innertext
         else
            row("errorcode")="0"
            row("description")="无错误信息!"
          end if

          if dt_temp.rows(i)("result")="fail" then
             dim node_result_1 as xmlnode=document_out.selectsinglenode("response/exception/code")
             if isnothing(node_result_1)=false then
                if node_result_1.innertext="fail" then
                   dim node_code_1 as xmlnode=document_out.selectsinglenode("response/exception/code")
                   dim node_desc_1 as xmlnode=document_out.selectsinglenode("response/exception/sysmsg")
                   if isnothing(node_code_1)=false and  isnothing(node_desc_1)=false then
                      row("errorcode")=node_code_1.innertext
                      row("description")=node_desc_1.innertext
                   else
                      continue for
                   end if
                 end if
               end if
           end if
           if row("description").tostring().indexof("axm-106")>0 then
              continue for
           end if
        catch ex as exception
              row("errorcode")="0"
              row("description")="无错误提示信息!"
        end try
 
         row("date")=dt_temp.rows(i)("createdate")
         forj=0 to dt.rows.count-1
            if row("no")=dt.rows(j)("no") and row("errorcode")=dt.rows(j)("errorcode") and row("description")=dt.rows(j)("description")then
               is_exsit=true
            end if
          next
          if is_exsit=false then
             dt.rows.add(row)
          end if
       next
      
         
                               
            
     
     

posted @ 2013-10-15 14:55  小河叮咚  阅读(200)  评论(0编辑  收藏  举报