如何将XML数组格式转换为可读格式

时间:2016-12-29 06:36:18

标签: php xml xml-parsing

我将XML文件中的数据转换为数组,我希望以可读的格式向用户显示,以便他能够理解我将向他们展示的结果。这是我从数组格式的XML文件中获取的内容

SimpleXMLElement Object
  (
  [@attributes] => Array
  (
  [ID] => xmlReport
  )

  [root] => SimpleXMLElement Object
  (
  [record] => Array
  (
  [0] => SimpleXMLElement Object
  (
  [@attributes] => Array
  (
  [no] => 1
  )

  [sol_id] => 0413
  [acctNum] => 041305500446
  [tran_date] => 22-DEC-2016
  [tran_particular] => B/F
  [tran_rmks] => -
  [instrmnt_num] => -
  [part_tran_type] => -
  [dr_tran_amt] => -
  [cr_tran_amt] => -
  [bal_amt] => 15212.75
  [ini_sol_desc] => -
  )

  [1] => SimpleXMLElement Object
  (
  [@attributes] => Array
  (
  [no] => 2
  )

  [sol_id] => 0413
  [acctNum] => 041305500446
  [tran_date] => 23-Dec-2016
  [tran_particular] => AKC MOTORS /009557/HDFC
  [tran_rmks] => SMS FACTORY
  [instrmnt_num] => -
  [part_tran_type] => C
  [dr_tran_amt] => 0.00
  [cr_tran_amt] => 8000.00
  [bal_amt] => 23212.75
  [ini_sol_desc] => RPC - LUDHIANA
  )

  [2] => SimpleXMLElement Object
  (
  [@attributes] => Array
  (
  [no] => 3
  )

  [sol_id] => 0413
  [acctNum] => 041305500446
  [tran_date] => 26-Dec-2016
  [tran_particular] => TRFR FROM*MAGNIFIQUE GROUP
  [tran_rmks] => -
  [instrmnt_num] => -
  [part_tran_type] => C
  [dr_tran_amt] => 0.00
  [cr_tran_amt] => 20000.00
  [bal_amt] => 43212.75
  [ini_sol_desc] => MODEL TOWN LUDHIANA
  )

  [3] => SimpleXMLElement Object
  (
  [@attributes] => Array
  (
  [no] => 4
  )

  [sol_id] => 0413
  [acctNum] => 041305500446
  [tran_date] => 28-Dec-2016
  [tran_particular] => BHARTI AIRTEL LTD
  [tran_rmks] => The zone serial is [ 15].
  [instrmnt_num] => 44936
  [part_tran_type] => D
  [dr_tran_amt] => 3663.00
  [cr_tran_amt] => 0.00
  [bal_amt] => 39549.75
  [ini_sol_desc] => RPC - LUDHIANA
  )

  )

  )

  )

以及我想要的结果

 sol_id : 0413
  acctNum : 041305500446

等等

0 个答案:

没有答案