Help with Deserializing XML

Hi, I need help deserializing XML which I am not familiar with, I can’t seem to understand how to get the elements. When I tried getting the nodes, message box throws me the entire XML files contents. Below are sample of my XML file and workflow which is giving me the error The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name.

image

Hi,

You need to handle XML namespace using xNamespace class as the following.

xns = xelement.Name.Namespace
listxelement = xelement.Descendants(xns+“Name”)

If you can share your xml as a file, we might be able to comment more specifically.

Regards,

Hi @Yoichi,

Attached is my sample XML file. Please help. Thank you!

Data_00000032Sample.xml (2.4 KB)

Hi,

In this case, you don’t need to handle Namespace as the following step.

xElem =xDoc.Root
xeSig = xElem.First()
strNameValue = xeSig.Elements("_Name").First().Value

now, xDoc is output of Deserialize XML, xElem and xeSig is xElement Type variable.

Regards,

1 Like

Hi,

If you want to use Namespace, you can also write as follows:

xElem =xDoc.Root
xns="http://www.abbyy.com/FlexiCapture/Schemas/Export/Singapore_PO.xsd"
xeSig = xElem.Element(xns+"_Singapore_PO")
strNameValue = xeSig.Elements("_Name").First().Value

Now, xns is xnsmespace type.

Regards,

1 Like

Thank you this worked perfectly.

1 Like

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