Results 1 to 4 of 4

Thread: HELP: Need to input into XML nodes

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    4

    HELP: Need to input into XML nodes

    Hello,

    Can someone please help me out here. I'm trying to input a value into an XML node. For example:

    Here is my XML code


    Code:XML Code

    <rootvalue>
    <MsgBody>
    <RouteMe>
    <Operation></Operation>
    <RouteDestination></RouteDestination>
    </RouteMe>
    </MsgBody>
    </rootvalue>


    I need to constantly change the value inside <Operation> and <RouteDestination>. I wrote the following code to change the string values.


    VB6 Code:

    Dim objRequestDOM As New MSXML2.DOMDocument40
    Dim objReplyNode As MSXML2.IXMLDOMElement
    Dim OperationVal As String
    Dim Route As String

    On Error GoTo ErrorHandler

    If Not objRequestDOM Is Nothing Then
    Set objRequestNode = objRequestDOM.selectSingleNode("//MsgBody/RoutingMe")
    If Not (Operation = "") Then
    objRequestNode.selectSingleNode("Operation").Text = OperationVal 'Is this how you write the value into the node?
    End If
    If Not (Route = "") Then
    objRequestNode.selectSingleNode("RouteDestination").Text = Route
    End If
    End If

    Can someone please help me out? I need to finish this project soon. Thanks.

    - Raux

  2. #2
    Member
    Join Date
    Jul 1999
    Location
    edmonton, canada
    Posts
    60
    *BUMP*

    yeah, I'd love to know how to write to an XML node as well. Everything I've seen treats writing of XML as basic text data...NOT xml.
    reading is easy...but writing is not.
    Surely, MS has a way of writing to XML data...don't they?

    ???

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I haven't got time to test it but try

    VB Code:
    1. Set objRequestNode = objRequestDOM.selectSingleNode("Operation")
    2. objRequestNode.Text = OperationVal

    Phyl: Note that we are using MSXML4 which is the Microsoft Object Model (the "DOM"). It has built in methods for handling XML.

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width