Solved

Add node to XML Doc

Posted on 2013-06-27
4
320 Views
Last Modified: 2013-07-03
I have the following code below
Is it possible to insert a node in the XMLDoc on the fly?
I would want to insert it right before the //Result node.

etc...
 Dim b As Boolean = sendToWebService(outputData)
etc...

 Private Function sendToWebService(ByVal text As String) As Boolean
        Try
            Dim b As Boolean = False
            Dim XmlDoc As New XmlDocument()
            Dim nameSpaceMgr As New XmlNamespaceManager(XmlDoc.NameTable)
            nameSpaceMgr.AddNamespace("csta", "http://www.ecma-international.org/standards/ecma-323/csta/ed5")
            nameSpaceMgr.AddNamespace("m5", "http://www.m5net.com/org/m5/data/v2/cti")
            XmlDoc.LoadXml(text)
              If Not (XmlDoc.SelectSingleNode("//Result") Is Nothing) Then


etc...
0
Comment
Question by:lrbrister
  • 3
4 Comments
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39283950
Hi,

Can you add a small sample xml for our testing purposes?

Giannis
0
 

Author Comment

by:lrbrister
ID: 39284066
It would be after the Error and ID tags below...

<org.m5.api.v1.Response xmlns:m5="http://www.m5net.com/org/m5/data/v2/cti" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed5">
    <ErrorCount>0</ErrorCount>
    <Id>1</Id>
    <Result xsi:type="org.m5.data.v2.cti.HostedConnectObject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <csta:MonitorStartResponse>
            <csta:monitorCrossRefID>1394</csta:monitorCrossRefID>
        </csta:MonitorStartResponse>
    </Result>
</org.m5.api.v1.Response>
0
 

Accepted Solution

by:
lrbrister earned 0 total points
ID: 39284648
Found my own solution
0
 

Author Closing Comment

by:lrbrister
ID: 39296000
outputData = Replace(outputData, "<Result>", "<timeStamp>" & Now().ToString("yyyy-MM-dd HH:mm:ss.fff") & "</timeStamp><Result>")
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question