Foxtable(狐表)用户栏目专家坐堂 → [求助]关于XML


  共有2550人关注过本帖树形打印复制链接

主题:[求助]关于XML

帅哥哟,离线,有人找我吗?
大王派我玩狐表
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:21 积分:251 威望:0 精华:0 注册:2017/10/23 16:02:00
[求助]关于XML  发帖心情 Post By:2017/12/21 17:35:00 [只看该作者]

<?xml version="1.0" encoding="UTF-8" standal?>
<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" n License="">
  <Events version="">
    <Event name="RelationCreate">
      <Relation productCode="9223173"   Workline="WL000090">
        <Batch batchNo="1709005A1"   lineManager="WL000090" TaskNo="WT005701">
          <Code curCode="88968550000073067713" packLayer="3" flag="0" />
          <Code curCode="88968560000799913239" packLayer="2" parentCode="88968550000073067713" flag="0" />
          <Code curCode="81866130008866506592" packLayer="1" parentCode="88968560000799913239" flag="0" />
          <Code curCode="81866130008866785328" packLayer="1" parentCode="88968560000799913239" flag="0" />
          <Code curCode="81866130008867068911" packLayer="1" parentCode="88968560000799913239" flag="0" />
          <Code curCode="81866130008867344383" packLayer="1" parentCode="88968560000799913239" flag="0" />
          <Code curCode="81866130009040153775" packLayer="1" parentCode="88968560000763965924" flag="2" />
        </Batch>
      </Relation>
    </Event>
  </Events>
</Document>


如何导入进FOXTABLE

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/12/21 17:59:00 [只看该作者]

参考代码

 

Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
    Dim txt As String = FileSys.ReadAllText(dlg.FileName, Encoding.Default)
    Dim idx1 As Integer = txt.IndexOf("<Events")
    Dim idx2 As Integer = txt.IndexOf("</Events>")
   
    Dim s As String = txt.SubString(idx1, idx2-idx1+9)
    Dim xmlDoc As New System.XML.XmlDocument
    xmlDoc.Loadxml(s)
    Dim ndList  = xmlDoc.GetElementsByTagName("Code")
   
    For i As Integer = 0 To ndList.count - 1
        Dim curCode As String = ndList(i).Attributes("curCode").value
        Dim packLayer As String = ndList(i).Attributes("packLayer").value
        Dim flag As String = ndList(i).Attributes("flag").value
        output.show(curCode & " " & packLayer & " " & flag)
    Next
   
End If


 回到顶部
帅哥哟,离线,有人找我吗?
放晴的天空
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:4 积分:91 威望:0 精华:0 注册:2018/5/16 9:56:00
  发帖心情 Post By:2018/5/16 15:00:00 [只看该作者]

谢谢,版主!

 回到顶部