XML - 我需要帮助获取 ID 属性值
我正在使用 ColdFusion 7,并且是解析 XML 的新手。
我正在尝试获取 ID 属性并提取其值。
<cfset newRate = StructNew()>
<cfset newRate.Carrier = "USPS">
<cfset newRate.Code = Service[i].ID.XmlAttribute>
<cfset newRate.Descr = Service[i].SvcDescription.XmlText>
<cfset newRate.Price = Service[i].Postage.XmlText>
我已经尝试了所有我能想到的获取 ID 属性的组合,但没有任何效果。
你能帮忙吗?
++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++
这会返回一个数组:
<cfset newRate.Code = xmlSearch(Service[i], "/@ID")>
您可以在此处查看真实的 XML;
https://secure.thelowertowngroup.com/steinair/usps/usps_rates_international.cfm
I am using ColdFusion 7 and am new at parsing XML.
I am trying to get at the ID property and extract its value.
<cfset newRate = StructNew()>
<cfset newRate.Carrier = "USPS">
<cfset newRate.Code = Service[i].ID.XmlAttribute>
<cfset newRate.Descr = Service[i].SvcDescription.XmlText>
<cfset newRate.Price = Service[i].Postage.XmlText>
I have tried every combination I can think of to get at the ID property, but nothing works.
Can you help?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This returns an array:
<cfset newRate.Code = xmlSearch(Service[i], "/@ID")>
You can view the real XML here;
https://secure.thelowertowngroup.com/steinair/usps/usps_rates_international.cfm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我需要这样做有点盲目,因为我们看不到您的 XML(根据我之前的评论,您提供的链接已损坏)。
但是...考虑一下这段代码:
有一些用于获取 ID 的选项。他们中的任何一个有帮助吗?
Am needing to do this a bit blind as we can't see your XML (as per my earlier comment, the link you provide is broken).
However... consider THIS code:
There's some options for fetching IDs. Do any of them help?