Solved

Add node to XML Doc

Posted on 2013-06-27
4
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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