XElement Replacing of Values

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <DoLoginUserByNameV1 xmlns="http://test.org/">
            <userName>USER</userName>
            <password>PASS</password>

Hi guys I’m having difficulty Assigning the User/Pass to the above code.

Basically I am assigning the above to an ‘XElement’ Type, and my aim is to then replace USER and PASS with variables, but I am having difficulty getting these to change.

Wondering if anyone would have a solution for replacing once this XElement is set (body for a subsequent HTTP Request)

I have tried testing .Element, .Attribute and such, but can’t seem to replace these values.

Any help would be great!

@Kyleb91
have you implemented the handling of namespaces for getting the element so far?

in General we do within an assign:
myXeElement.Value = “NewValue”

grafik

Hey @ppr thanks for reaching out.

I don’t have an Xdoc VAR yet, I am simply assigning this body above to an XElement VAR and then using. After the request I am using this Xdoc from the response.

image

sure you do not have the Variable with its names as I did use for the demo
But you have serialized the XML e.g. with Deserialize Element Activity and will have used another Varname. So just adopt.

As described above and show cased in the immediate box: Namespaces ware to handle and we can update.

A screenshot like:

gives us not info as we cannot see what was implemented.

Just cross check what you can integrate / adopt from working demo in your implementation. otherwise please tell us:

  • what was implemented?
  • what is working / what is not working in detail

Thanks for support

Thanks man _Test.xaml (6.5 KB)

I don’t have a lot, the above file should be clearer from what I’m trying to do…

Ok saw it. It is maybe a too minimalistic implementation approach. But as you have seen above when working with index we can update:

grafik
grafik

In case of you want to work more close to normal XML Processing eg using element names for retrieval , then you will deal with namesspaces or has to shortcut on Local names.

1 Like

Ahhh Descendants, of course! Brilliant, thanks!

How did you know to use this method? Also is it possible to replace both in a single statement/assign? Just Wondering.

Thanks again!

worked a lot with XML, so it is count to the regular methods / Tools

not recomended, also not recommended processing XML with RegEx

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.