M
Morten Wennevik
Hi,
I'm trying to dynamically add items in a DropDownList. The DropDownList
uses a repeating field my:ListeLookup to fill the values and this field
has no values in it to begin with. I add values to the xml in an external
program using this code
Dim doc As New System.Xml.XmlDocument()
doc.LoadXml(XML43.XmlString)
Dim nsmgr As New XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("my",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28")
Dim node As XmlNode = doc.SelectSingleNode("my:nyKunde/my:ListeLookup",
nsmgr)
Dim newNode As XmlNode = doc.CreateNode(XmlNodeType.Element,
"my:NewName",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28")
newNode.InnerText = "Hello World"
node.AppendChild(newNode)
XML43.XmlString = doc.OuterXML
In a pane in the InfoPath form this xml is replaced with the existing
using replaceChild but I get this error
Element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28}NewName'
is unexpected according to content element of parent element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28}ListeLookup'
How can I get NewName to be expected?
- Morten
I'm trying to dynamically add items in a DropDownList. The DropDownList
uses a repeating field my:ListeLookup to fill the values and this field
has no values in it to begin with. I add values to the xml in an external
program using this code
Dim doc As New System.Xml.XmlDocument()
doc.LoadXml(XML43.XmlString)
Dim nsmgr As New XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("my",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28")
Dim node As XmlNode = doc.SelectSingleNode("my:nyKunde/my:ListeLookup",
nsmgr)
Dim newNode As XmlNode = doc.CreateNode(XmlNodeType.Element,
"my:NewName",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28")
newNode.InnerText = "Hello World"
node.AppendChild(newNode)
XML43.XmlString = doc.OuterXML
In a pane in the InfoPath form this xml is replaced with the existing
using replaceChild but I get this error
Element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28}NewName'
is unexpected according to content element of parent element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-16T08:03:28}ListeLookup'
How can I get NewName to be expected?
- Morten