以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  这样的数据结构分解  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=127806)

--  作者:rjh4078
--  发布时间:2018/11/22 13:32:00
--  这样的数据结构分解
SAP中导出了如下格式个数据,如何分解开来

<订单明细 产品名称="test"><材料明细><Item 颜色="C" 重量="" 长度="150" 钢卷="MH290" 数量="" 其他="" /><Item 颜色="M" 重量="" 长度="" 钢卷="" 数量="" 其他="" /><Item 颜色="Y" 重量="" 长度="" 钢卷="" 数量="" 其他="" /></材料明细><加工参数><Item 车架号="" 电流大小="" 变形率="1:1" 扭矩大小="" 机器高度="" /></加工参数></订单明细>

应该是分解成一个主表和一个明细表,但是无法用xml或jason来解析


--  作者:有点甜
--  发布时间:2018/11/22 16:21:00
--  

参考代码

 

Dim str = ClipBoard.GetText
Dim xmlDoc As New System.XML.XmlDocument
xmlDoc.Loadxml(str)
Dim ndList  = xmlDoc.SelectNodes("/订单明细/材料明细/Item")
For i As Integer = 0 To ndList.count - 1
    Dim ys As String = ndList(i).Attributes("颜色").value
    Dim zl As String = ndList(i).Attributes("重量").value
    Dim cd As String = ndList(i).Attributes("长度").value
    output.show(ys & " " & zl & " " & cd)
Next

 


--  作者:rjh4078
--  发布时间:2018/11/22 17:06:00
--  
非常感谢 解决了大疑惑