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.
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?
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.
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.
I’m reading a value with this;
xdoc_XML.Descendants(cac+“AccountingSupplierParty”).Descendants(cac + “Party”).Descendants(cac + “PartyIdentification”).Descendants(cbc+ “ID”).FirstOrDefault().Value
But there’s a problem. There are three ID tags. Check below;
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:
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.