以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- xml文件提取 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91376) |
-- 作者:rjh4078 -- 发布时间:2016/10/9 15:16:00 -- xml文件提取 <?xml version="1.0" encoding="utf-8"?> <iDLabelInfo> <ProductName>LUNAR FLYKNIT 3 iD</ProductName> <Sizes> <sz SizeCode="12.5" SizeType="us" /> <sz SizeCode="11" SizeType="uk" /> </Sizes> <MainColorway>Black Heather/Volt/white</MainColorway> <DesignedBy>Hiroyuki Sugiyama</DesignedBy> <ImageURL>http://origin-nikeid.nike.com//services/imgredirect/mtr-802081658/bgc-na/wid-574/vw-9</ImageURL> <WorkOrderNumber>W00001</WorkOrderNumber> </iDLabelInfo> 如上 如何提取里面信息转到数据库里 ? [此贴子已经被作者于2016/10/9 15:16:25编辑过]
|
-- 作者:有点蓝 -- 发布时间:2016/10/9 15:40:00 -- https://www.baidu.com/baidu?word=xml%E8%A7%A3%E6%9E%90&ie=utf-8&tn=myie2dg&ch=6 Dim document As New System.Xml.XmlDocument document.LoadXml("<?xml version=""1.0"" encoding=""utf-8""?><iDLabelInfo> <ProductName>LUNAR FLYKNIT 3 iD</ProductName> <Sizes> <sz SizeCode=""12.5"" SizeType=""us"" /> <sz SizeCode=""11"" SizeType=""uk"" /> </Sizes> <MainColorway>Black Heather/Volt/white</MainColorway> <DesignedBy>Hiroyuki Sugiyama</DesignedBy> <ImageURL>ttp://origin-nikeid.nike.com//services/imgredirect/mtr-802081658/bgc-na/wid-574/vw-9</ImageURL> <WorkOrderNumber>W00001</WorkOrderNumber></iDLabelInfo>") Output.Show(document.DocumentElement("ProductName").InnerText) |
-- 作者:rjh4078 -- 发布时间:2016/10/9 18:39:00 -- 通过FT的导入方式来 这个文件包含三个表和相关字段数据 我的意思是 如何将固定格式的这种文件读取以后 填充到对应数据表和字段 |
-- 作者:有点蓝 -- 发布时间:2016/10/10 9:00:00 -- 提取出内容,自己想怎么处理都可以。 Dim document As New System.Xml.XmlDocument document.LoadXml("<?xml version=""1.0"" encoding=""utf-8""?><iDLabelInfo> <ProductName>LUNAR FLYKNIT 3 iD</ProductName> <Sizes> <sz SizeCode=""12.5"" SizeType=""us"" /> <sz SizeCode=""11"" SizeType=""uk"" /> </Sizes> <MainColorway>Black Heather/Volt/white</MainColorway> <DesignedBy>Hiroyuki Sugiyama</DesignedBy> <ImageURL>ttp://origin-nikeid.nike.com//services/imgredirect/mtr-802081658/bgc-na/wid-574/vw-9</ImageURL> <WorkOrderNumber>W00001</WorkOrderNumber></iDLabelInfo>") For Each n As Xml.XmlNode In document.DocumentElement.ChildNodes If n.Name <> "#text" Then Output.Show(n.Name & "=" & n.InnerText) End If For Each n1 As Xml.XmlNode In n.ChildNodes If n1.Attributes IsNot Nothing Then For Each xa As Xml.XmlAttribute In n1.Attributes Output.Show(xa.Name & "=" & xa.Value) Next End If Next Next |