473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"This document already has a 'DocumentElement' node" error

I am clueless...
Here is my code:
Private Sub genCodeDynamic(ByVal nIn As XmlNode, ByRef nOut As XmlNode, ByVal docOut As XmlDocument, _
ByVal stopAtNode As XmlNode, ByVal dr As DataRow)
Dim d1 As String = docOut.InnerXml 'debug

Try
Dim t As XmlNode 'text nodes
If Not (nIn Is Nothing) AndAlso nIn.HasChildNodes Then
Dim xc As XmlNodeList = nIn.SelectNodes("*")
Dim x As XmlNode
For Each x In xc
nOut = nOut.AppendChild(docOut.CreateElement(x.Name))

t = x.SelectSingleNode("text()")

If Not (t Is Nothing) Then
If Len(t.Value) > 3 And Microsoft.VisualBasic.Left(t.Value, 3) = "DB:" Then
'Dim dtest As String = dr("docid")
Dim drs As String = Database.safedbstr(dr, Microsoft.VisualBasic.Right(t.Value, Len(t.Value) - 3))
nOut.AppendChild(docOut.CreateTextNode(Database.sa fedbstr(dr, Microsoft.VisualBasic.Right(t.Value, Len(t.Value) - 3))))
Else
nOut.AppendChild(docOut.CreateTextNode(t.Value))
End If

End If

Dim ac As XmlAttributeCollection = x.Attributes
Dim aIn As XmlAttribute
Dim aOut As XmlAttribute
For Each aIn In ac
aOut = docOut.CreateAttribute(aIn.Name)
If Len(aIn.Value) > 3 And Microsoft.VisualBasic.Left(aIn.Value, 3) = "DB:" Then
aOut.Value = Database.safedbstr(dr, Microsoft.VisualBasic.Right(aIn.Value, Len(aIn.Value) - 3))
Else
aOut.Value = aIn.Value
End If
'ret = ret & "a.Value = """ & a.Value & """" & vbCrLf
nOut.Attributes.SetNamedItem(aOut)
Next
'Now get all the child nodes of x
If x.HasChildNodes AndAlso Not (x Is stopAtNode) Then
'ret = genCode(x, ret, stopAtNode)
genCodeDynamic(x, nOut, docOut, stopAtNode, dr)
End If
nOut = nOut.ParentNode
Next
End If

Catch ex As Exception
handleException(ex)
End Try
End Sub
Jul 18 '07 #1
0 1322

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Ernst Murnleitner | last post by:
Dear Readers, Is it possible to forbid conversion from this or use of this in general except where it is explicitly wanted? Reason: I changed my program from using normal pointers to...
0
by: Colleyville Alan | last post by:
My app is giving me this error. Run-time error 3211: The database engine could not lock table 'Sorted_Template' because it is already in use by another person or process. When I run the app...
0
by: Richard Sherratt | last post by:
Something to add to your trivia bank. I've seen previous questions on this error but they've all been for adding new records to the RecordsetClone. I got it trying to edit an existing record. ...
4
by: Saso Zagoranski | last post by:
Hi! I have a little search textbox, which goes through a dataset as the user types in the textbox... If the user types "1", then all the fields beginning with a 1 get shown in the datagrid... ...
4
by: Richard | last post by:
When I reference "this" in call to event, I get the following error: An unhandled exception of type 'System.NullReferenceException' occurred in csbasesockets.dll Additional information: Object...
0
by: Neal | last post by:
I am getting the "This type of page is not served." error the first time I access our asp.net site after an application restart. I can hit refresh and it will work fine the second and every other...
0
by: gahagan | last post by:
If you encounter this error, most likely one of the controls you're trying to cut/paste is a combo box with a longer-than-average 'Row Source' value. That, apparently, is the problem. Shorter Row...
1
by: gslim | last post by:
I am trying to implement the busybox sample from // From Mark Wagner // http://blogs.crsw.com/mark/articles/642.aspx When I get to this line I get an access denied error. Could someone give me...
5
by: darrel | last post by:
We're getting this error on a page that uses a particular User Control we created: "An Error has Occured retrieving the news item. Attempted to read or write protected memory. This is often an...
6
by: babakandme | last post by:
Hi to every body...:D I'm a novice C++ programmer & I've a question, I have the ClassA & in it's constructor, I instantiate ClassB, and I want send "this" pointer """pointer to ClassA""" to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.