How to read XML into a DataTable?

后端 未结 7 1600
星月不相逢
星月不相逢 2020-12-16 02:51

I have some XML in a string in memory exactly like this:


  EURCHF
  EURGBP         


        
7条回答
  •  爱一瞬间的悲伤
    2020-12-16 03:33

    Here is a sample-code in Powershell:

    $xmlString = @"
    
        
            value1value2
        
        
            value3value4
        
    
    "@
    $sr =[System.IO.StringReader]($xmlString)
    
    $dataset =[System.Data.DataSet]::new()
    $null = $dataset.ReadXml($sr)
    

    and this is the result of $dataset.tables:

    c1     c2    
    --     --    
    value1 value2
    value3 value4
    

提交回复
热议问题