create XML element with namespace

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2006
Posts: 2
Reputation: MikeLI is an unknown quantity at this point 
Solved Threads: 0
MikeLI MikeLI is offline Offline
Newbie Poster

create XML element with namespace

 
0
  #1
Jun 28th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1
Reputation: yong9900 is an unknown quantity at this point 
Solved Threads: 0
yong9900 yong9900 is offline Offline
Newbie Poster

Re: create XML element with namespace

 
0
  #2
Jul 18th, 2006
I got the same problme
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC