D
dferrell
For some reason myFunction in the below code is treating the parameter
oInputDoc1 as a ByRef rather than a ByVal. When the call returns, both
oInputDoc and oOutputDoc = "<root><name>Steve Jobs</name></root>"
When using a string instead of an xml document as the parameter the
argument and value remain ByVal and the results are as I would expect.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim s As String = "<root><name>Bill Gates</name></root>"
Dim oInputDoc As System.Xml.XmlDocument = New
System.Xml.XmlDocument
Dim oOutputDoc As System.Xml.XmlDocument = New
System.Xml.XmlDocument
oInputDoc.LoadXml(s)
oOutputDoc = myFunction(oInputDoc)
Response.Write(oInputDoc.OuterXml)
Response.Write("<BR>")
Response.Write(oOutputDoc.OuterXml)
End Sub
Private Function myFunction(ByVal oInputDoc1 As System.Xml.XmlDocument)
As System.Xml.XmlDocument
Dim s As String = "<root><name>Steve Jobs</name></root>"
oInputDoc1.LoadXml(s)
Return oInputDoc1
End Function
oInputDoc1 as a ByRef rather than a ByVal. When the call returns, both
oInputDoc and oOutputDoc = "<root><name>Steve Jobs</name></root>"
When using a string instead of an xml document as the parameter the
argument and value remain ByVal and the results are as I would expect.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim s As String = "<root><name>Bill Gates</name></root>"
Dim oInputDoc As System.Xml.XmlDocument = New
System.Xml.XmlDocument
Dim oOutputDoc As System.Xml.XmlDocument = New
System.Xml.XmlDocument
oInputDoc.LoadXml(s)
oOutputDoc = myFunction(oInputDoc)
Response.Write(oInputDoc.OuterXml)
Response.Write("<BR>")
Response.Write(oOutputDoc.OuterXml)
End Sub
Private Function myFunction(ByVal oInputDoc1 As System.Xml.XmlDocument)
As System.Xml.XmlDocument
Dim s As String = "<root><name>Steve Jobs</name></root>"
oInputDoc1.LoadXml(s)
Return oInputDoc1
End Function