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

I got the same problme

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.