Results 1 to 3 of 3

Thread: edit xml document

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2010
    Posts
    79

    edit xml document

    I have an XML document that I am trying to update specific nodes but the node attributes seem to get in the way. If I leave the attributes, "xmlns:.." and try to search, i get an error that says the node is nothing BUT if I rename the "xmlns:" to "ns", the search works. why is this?? I am trying to use the XMLDocument since once the change has been made, the file has to be moved to another network folder.
    If anyone has a better idea than what I am trying to do, please let me know. The full XML is below as is the code I am trying to use.
    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <soap:Envelope xmlns:xsd= "http:=//sometext/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <fiAPI xmlns="http://sometextr.com" xmlns:ITI="http://www.Wnet.com/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/xmlenc#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sometext.api.com/API.xsd">
        <fiHeader Version="2.2">
        <Service Name="TST1337" Version="10.0">
        <DateTime>2020-01-09T18:08:02-06:00</DateTime>
        <UUID>23e7a103-fa5b-blah-blah-bf18b1068b4b</UUID>
        </Service>
      <Security>
        <AuthenticationMaterial>
          <SignedToken>
            <EncryptedData>
              <CipherData xmlns="http://www.w3.org/2001/04/xmlenc#">
                <CipherValue>anencryptedstring</CipherValue>
              </CipherData>
            </EncryptedData>
          </SignedToken>
        </AuthenticationMaterial>
        <PrincipalID>Prometheus</PrincipalID>
        <TrustRelationship xmlns="http://www.Wnet.com/">TrustedUser</TrustRelationship>
      </Security>
      <Client>
        <VendorID>FNB-AK!</VendorID>
        <AppID>FNB-AK!INST000</AppID>
        <OrgID>00</OrgID>
        <SessionID></SessionID>
      </Client>
      <DataSource>
        <URI>TEST</URI>
      </DataSource>
    </fiHeader>
    <Request Echo="false" TypeOfRequest="GetName">
      <NameID>5371</NameID>
      <GroupName>TEST</GroupName>
      <InstNumber>00</InstNumber>
      <Sequence>1</Sequence>
      <Type>Names</Type>
      <Type>AccountNameRelationships</Type>
    </Request>
    </fiAPI>
      </soap:Body>
    </soap:Envelope>
    
           Dim MyXML As New XmlDocument()
            MyXML.Load("..\..\FNBAXMLFile.xml")
            Dim MyXMLNode As XmlNode = MyXML.SelectSingleNode("/fiAPI/Security/AuthenticationMaterial/SignedToken/EncryptedData/CipherData/CipherValue")
            If MyXMLNode IsNot Nothing Then
                MyXMLNode.ChildNodes(0).InnerText = "CHANGED"
                MyXML.Save("C:\Temp\XmlTest.xml")
            Else
                MessageBox.Show("node is Nothing")
            End If ' Save the Xml.
    Last edited by ahbenshaut; Mar 25th, 2020 at 07:39 AM.

Tags for this Thread

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