Skip to main content
Nintex Community Menu Bar

XML value woes

  • April 26, 2006
  • 2 replies
  • 14 views

Forum|alt.badge.img+5
Hello,
I'm having trouble to insert a value to an xml field from a webform.
Attachment 1 shows my XML Schema.
From my webform code, I do CreateProcessInstance.
Then I create the xmldocument.
Dim doc As New System.Xml.XmlDocument
doc.LoadXml(pi.XmlFields("Complaint").Schema)
doc.DocumentElement.RemoveAll()
Dim strRoot As XmlElement = doc.CreateElement("Root")
strRoot.Prefix = "mstns"
Dim strKlachten As XmlElement = doc.CreateElement("Klachten", "mstns")
strKlachten.Prefix = "mstns"
Dim strGegevens As XmlElement = doc.CreateElement("Gegevens", "mstns")
strGegevens.Prefix = "mstns"
Dim attFlowState As XmlAttribute = doc.CreateAttribute("FlowState")
attFlowState.Value = "Prior"
strGegevens.SetAttributeNode(attFlowState)
strKlachten.AppendChild(strGegevens)
strRoot.AppendChild(strKlachten)
doc.DocumentElement.AppendChild(strRoot)
pi.XmlFields("Complaint").Value = doc.InnerXml
k2conn.StartProcessInstance(pi)
pi.Update()
k2conn.Close()

In my Activity I created a Server Mail. In the body I insert: [{K2.ProcessInstance.XmlFields("Complaint/mstns:Root/mstns:Klachten/mstns:Gegevens/@FlowState").Value}]

When I run the process, something is written to the error log (error item name: server mail): XPath : "mstns:Root/mstns:Klachten/mstns:Gegevens/@FlowState" could not be resolved on this document.

Any Suggestions:

2 replies

Forum|alt.badge.img+5
  • Author
  • April 26, 2006
I forgot to mention the content of doc.innerxml:
<?xml version="1.0" encoding="utf-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><Root><mstns:Klachten xmlns:mstns="mstns"><mstns:Gegevens FlowState="Prior" /></mstns:Klachten></Root></xs:schema>

Forum|alt.badge.img+4
  • April 27, 2006
Hi NS,

I would not be suprised if the problem was the "@" in your XML that was the problem. To test this click on the "..." Button to the side of the email body textbox and navigate to the required XML node using the K2 selector. This will give the correct format.

Do not confuse XPath and XML at this point :-(

For experimenting I usually try the Data Manipulation Event and navigate to the required instance variable and then generate the code as needed.

Hope this helps.

Regards
Graham