Issue with replacing value of XML element attribute


I want to replace several values in an XML file and I have an issue with replacing the value of the cbc:EndpointID. See under for the XML structure.

      <cbc:EndpointID schemeID="0192">123456789</cbc:EndpointID>
        <cbc:ID schemeID="0192">123456789</cbc:ID>

I have succesfully managed to replace other values with an invoke code activity with the following code:


However, when I attempt to change the value of an element with a space in the element name I recieve the following exception:

Exception -The ' ' character, hexadecimal value 0x20, cannot be included in a name

Has anyone experienced a similiar issue or do you have an idea on a workaround?


Hello @joergen_moeller

Here in cbc:EndpointId, where is the space? If you doubt about a space can you use Trim to remove the unwanted spaces. Also sharing a previous post which discussed about the data fetching from xml.

1 Like


The only space I can find the space within the element name itself (cbc:EndpointID SPACE schemeID=“0192”). I have tested with trimming the element name, but as you would expect it has to be consistent.

I have looked through the link you attached but it did not help me solve the issue.


Can you check the below post.

1 Like

Thank you, @Rahul_Unnikrishnan.
By reading the last thread you posted I understood that you do not need to specify the schemeID within the namespace. Only refering to EndpointID is sufficient.

For anyone that may experience this issue the solution is to exclude the scheme ID within the element name:

1 Like

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