以文本方式查看主题 - 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=149147) |
|
-- 作者:lanbor -- 发布时间:2020/4/24 15:04:00 -- 请教XML语句生成方法 正在学习以下练习。 本页地址:http://www.foxtable.com/mobilehelp/topics/0172.htm但针对这类语句不明白应该如何组合FT代码来生成XML格式语句,请专家指点。 <request type="sync" key="e3839305c3fc25529335d489247d0f21">
<host prod="XThirdParty" ver="1.0" ip="127.0.0.1" id="" lang="zh_CN" timestamp="20170426161614037" acct="db_nsyt" />
<field name="SequenceNumber" type="numeric">1</field>
<field name="PO_DOC_NO" type="string">A350-202004150001</field> </request> 拜求专家点拨几条具体语句,谢谢你! |
|
-- 作者:有点蓝 -- 发布时间:2020/4/24 15:13:00 -- 例如 Dim jo As New Foxtable.XObject jo("request")= New JObject jo("request")("@type")= "sync" jo("request")("@key")= "e3839305c3fc25529335d489247d0f21" jo("request")("host")= New JObject jo("request")("host")("@prod")= "XThirdParty" msgbox(jo.ToXML) 属性前面加@符号即可 |
|
-- 作者:lanbor -- 发布时间:2020/4/24 16:22:00 -- 生成 XML 代码再求教 Dim jo As New Foxtable.XObject Dim s1 As String = "XThirdParty" Dim PO_DOC As String = "A350-202004150001" Dim ja As New JArray jo("request")= New JObject jo("request")("@type")= "sync" jo("request")("@key")= "e3839305c3fc25529335d489247d0f21" jo("request")("host")= New JObject jo("request")("host")("@prod")= "XThirdParty" jo("request")("host")("@ver")= "1.0" jo("request")("host")("@id")= "" jo("request")("host")("@lang")= "zh_CN" jo("request")("host")("@timestamp")= "20170426161604037" jo("request")("host")("@acct")= "db_nsyt" jo("request")("service") = New JObject jo("request")("service")("@prod")="E10" jo("request")("service")("@name")="PURCHASE_ARRIVAL.ImportData" jo("request")("service")("@ip")="192.168.1.2" jo("request")("service")("@id")="demo" jo("request")("payload")= New Jobject jo("request")("payload")("param")= New JObject jo("request")("payload")("param")("@key")="std_data" jo("request")("payload")("param")("@type")="xml" jo("request")("payload")("param")("data_request")= New JObject jo("request")("payload")("param")("data_request")("datainfo")= New JObject jo("request")("payload")("param")("data_request")("datainfo")=ja
Dim so As New JObject
so("parameter")= New JObject
so("parameter")("@key")="productName" ’这个结果参数没出现在 XML语句中
so("parameter")("@type")="string" ’这个结果参数没出现在 XML语句中
so("parameter")= s1 \'这人有值
ja.add(so) Output.Show(jo.ToXML) ’---结果如下: <xml><request type="sync" key="e3839305c3fc25529335d489247d0f21"><host prod="XThirdParty" ver="1.0" id="" lang="zh_CN" timestamp="20170426161604037" acct="db_nsyt" /><service prod="E10" name="PURCHASE_ARRIVAL.ImportData" ip="192.168.1.2" id="demo" /><payload><param key="std_data" type="xml"><data_request><datainfo><parameter>XThirdParty</parameter></datainfo></data_request></param></payload></request></xml> 请专家指点! 谢谢你! [此贴子已经被作者于2020/4/24 16:57:22编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2020/4/24 17:13:00 -- Dim jo As New Foxtable.XObject jo("request")= New JObject jo("request")("@type")= "sync" jo("request")("@key")= "e3839305c3fc25529335d489247d0f21" jo("request")("field") = New JObject jo("request")("field")("@name")= "PO_DOC_NO" jo("request")("field")("#text") = cstr(dr("po_doc")) msgbox(jo.ToXML) |
|
-- 作者:lanbor -- 发布时间:2020/4/24 23:30:00 -- 已经知道怎么在同层加多行了,谢谢专家! ‘------希望在同层下面连续得到以下结果的 3行时,一值无法实现 <field name="PO_DOC_NO" type="string">A360</field> \'单据类型 <field name="SUPPLIER_CODE" type="string">SY101002</field> \'供应商编号 <field name="DOC_DATE" type="date">20200410</field> \'单据日期 ‘------结果在同层下面只出现了第 3行
已经知道怎么在同层加多行了,谢谢专家!
[此贴子已经被作者于2020/4/25 17:34:47编辑过]
|