以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关于XML  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=111428)

--  作者:大王派我玩狐表
--  发布时间:2017/12/21 17:35:00
--  [求助]关于XML
<?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

--  作者:有点甜
--  发布时间: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


--  作者:放晴的天空
--  发布时间:2018/5/16 15:00:00
--  
谢谢,版主!