XPath和XElement

时间:2010-02-01 02:44:39

标签: vb.net

我有一个XElement和一个XPath表达式,用于从中选择一个节点。它在我编写的原始程序中工作正常但如果我将其粘贴到另一个程序则不起作用。我检查了引用和import语句。我做错了什么?

我认为问题可能是原始程序在wpf窗口的类中有代码,而它被移动到一个它不起作用的抽象类。

Dim X As XElement = _                                                                                                                                                                                                                                                                                           

    Dim XPath As String

    XPath = "//Transform3DGroup/TranslateTransform3D"

    X.XPathSelectElement(XPath).SetAttributeValue("OffsetX", "5")

    Console.WriteLine(X.ToString)

1 个答案:

答案 0 :(得分:0)

    Dim X As XElement = _

                                                                                                                                                                                                                                                                                          

    Dim XPath As String

    XPath = "//Transform3DGroup/TranslateTransform3D"

    X.XPathSelectElement(XPath).SetAttributeValue("OffsetX", "5")

    Console.WriteLine(X.ToString)