要插入的节点来自不同的文档上下文

时间:2016-08-18 20:02:56

标签: xml vb.net

我在下面的函数中收到此错误。

Public Function GetXmlEnvironment(ByVal xmlTree As XmlNode, ByVal objUser As XTUser, ByVal objModule As XTModuleInfo, ByVal objProject As XTProject, ByVal objPage As IXTPage) As XmlNode

    Dim objXml As XmlDocument = New XmlDocument()
    Dim xmlEnvironment As XmlElement

    xmlEnvironment = objXml.CreateElement("Environment")
    If (xmlTree.HasChildNodes()) Then
        xmlTree.FirstChild.AppendChild(xmlEnvironment) ' Error occurs here
    End If
' ...
End Function

我是否需要将XmlElement转换为XmlNode?

1 个答案:

答案 0 :(得分:2)

Select()