XML函数问题 [英] XML Functions problem

查看:101
本文介绍了XML函数问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个结构是准确的,所以我正在尝试测试看看是什么

我从这回来了:


昏暗xElem As Xml.XmlElement

Dim sVal As String

xElem = xmlPO.GetElementById(" Body / PurchaseOrder / OrderHeader")

sVal = xElem.GetAttribute(" BuyerOrderNumber")

有没有人看到一个明显的问题,如我所说,XML层次结构是否正确?b $ b是否正确?


-

TFWBWY ... A

I know that this structure is accurate, so I''m trying a test to see if what
I get back from this:

Dim xElem As Xml.XmlElement
Dim sVal As String
xElem = xmlPO.GetElementById("Body/PurchaseOrder/OrderHeader")
sVal = xElem.GetAttribute("BuyerOrderNumber")

Does anyone see an obvious problem, if, as I said, the XML hierarchy is
correct?

--
TFWBWY...A

推荐答案

可能:


xElem = xmlPO.GetElementById(" / Body / PurchaseOrder / OrderHeader")

sVal = xElem.GetAttribute(" @ BuyerOrderNumber")

Possibly:

xElem = xmlPO.GetElementById("/Body/PurchaseOrder/OrderHeader")
sVal = xElem.GetAttribute("@BuyerOrderNumber")


我刚刚穿过它并观看了汽车。盒子更紧密和

xElem仍被设置为Nothing在下面的第一个语句之后得到

对象引用未设置为对象的实例作为错误消息。

我试过Dim - 将xElem改为新的XML.XmlElement,但是构建不起作用

并说Overload分辨率失败,因为没有''新''可以访问。


嗯...


任何想法?


< za *** @ construction-imaging.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...
I just stepped thru it and watched the "Autos" box a bit more closely and
xElem is still set to "Nothing" after the first statement below and gets
"Object reference not set to an instance of the object" as an error message.
I tried "Dim"-ming xElem to a New XML.XmlElement, but the build didn''t work
and said "Overload resolution failed because no ''New'' is accessible."

Hmmm...

Any ideas?

<za***@construction-imaging.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
可能:

xElem = xmlPO.GetElementById(" / Body / PurchaseOrder / OrderHeader")
sVal = xElem.GetAttribute(" @ BuyerOrderNumber")
Possibly:

xElem = xmlPO.GetElementById("/Body/PurchaseOrder/OrderHeader")
sVal = xElem.GetAttribute("@BuyerOrderNumber")



Bryan Dickerson写道:
Bryan Dickerson wrote:
我刚刚走过它并观看了汽车。更紧密的盒子和/或xElem仍然设置为什么都没有在下面的第一个语句之后,得到
对象引用未设置为对象的实例作为一个错误信息。
我试着Dim-ming xElem到一个新的XML.XmlElement,但是构建没有工作
并且说Overload resolution failed,因为没有''New' 可以访问。

嗯...

任何想法?

< za *** @ construction-imaging.com>在消息中写道
新闻:11 ********************** @ z14g2000cwz.googlegr oups.com ......
I just stepped thru it and watched the "Autos" box a bit more closely and
xElem is still set to "Nothing" after the first statement below and gets
"Object reference not set to an instance of the object" as an error message.
I tried "Dim"-ming xElem to a New XML.XmlElement, but the build didn''t work
and said "Overload resolution failed because no ''New'' is accessible."

Hmmm...

Any ideas?

<za***@construction-imaging.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
可能:

xElem = xmlPO.GetElementById(" / Body / PurchaseOrder / OrderHeader")
sVal = xElem.GetAttribute(" @ BuyerOrderNumber")
Possibly:

xElem = xmlPO.GetElementById("/Body/PurchaseOrder/OrderHeader")
sVal = xElem.GetAttribute("@BuyerOrderNumber")





xElem = xmlPO.GetElementById(" / Body / PurchaseOrder / OrderHeader")

如果xElem什么都不是那么

messagebox.show("你没有找到任何使用该xpaht的元素)

else

sVal = xElem.GetAttribute(" @ BuyerOrderNumber")

结束如果


你不能新的xelem,它必须由GetElementById或
$ b $返回类似的功能。


克里斯



xElem = xmlPO.GetElementById("/Body/PurchaseOrder/OrderHeader")
if xElem is nothing then
messagebox.show("You did not find any elements using that xpaht")
else
sVal = xElem.GetAttribute("@BuyerOrderNumber")
end if

You can''t new the xelem, it has to be returned by the GetElementById or
a similar function.

Chris


这篇关于XML函数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆