944,123 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 9690
  • VB.NET RSS
Jun 28th, 2006
0

create XML element with namespace

Expand Post »
Hi All,

I have a function. It creates an XML element with namespace "pre":


 
Function newElement(ByVal doc  As XmlDocument, _
                             ByVal Name As String, _
                Optional ByVal text As String = Nothing, _
                Optional ByVal pre  As String = Nothing) As XmlElement
 
  Dim xmlEl As XmlElement = doc.CreateElement(pre, Name, "")
  If Not (text IsNothing) Then xmlEl.InnerText = text
  doc.DocumentElement.AppendChild(xmlEl)
  Return xmlEl
EndFunction


Then, I call that function in this way:
newElement(xmlDoc, "FirstName", "Peter", "pre")

I expect the result:
<pre:FirstName>Peter</FirstName>

However, the result has no "pre:", just:
<FirstName>Peter</FirstName>

Why?????

Mike
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MikeLI is offline Offline
2 posts
since Jun 2006
Jul 18th, 2006
0

Re: create XML element with namespace

I got the same problme
Reputation Points: 10
Solved Threads: 0
Newbie Poster
yong9900 is offline Offline
1 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Iis
Next Thread in VB.NET Forum Timeline: ASP .NET Web Application setup?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC