Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add node to XML Doc

Posted on 2013-06-27
4
Medium Priority
?
330 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

715 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